CakeEmail response of mail send - php

I can successfully send emails by using CakeEmail class of CakePHP.
But how can I be sure that the email is sent ?
Does a response comes when email is sent successfully?
When i take success response, I will redirect visitor to some other page.

send() method send the content array if the mail send successfully or it throws an exception.

Related

Send mail php with a .live email

I can send a email to my domain email but when using a .live email as the $to in php I get the error in the log "Denied ATTR36" is there anything I can do Thanks

How send Email from server email in laravel 5.3

I am new laravel and i just made a small project of article posting and on user registration i just want to send successfully register email to user email. I searched every where in all tutorials they are giving demo for send mail from gmail and some another email providers. I just want to know is it possible to send the mail simply from server email id ? like cordignator framework:
$this->email->to('rahul#gmail.com')
$this->email->subject('Testing Email')
$this->email->message('hello')
$this->email->send()
set your server mail details in .env file then
run a command php artisan publish
send mail like Mail::to($user)->send(new UserRegister());
and your UserRegister class in app/Mail have one method
public function build()
{
return $this->subject("Welcome to My site")
->view('`vendor.notifications.register`',compact(''));
}
And You can set all message body in resourse/view/vendor/notifications/register
see more on laravel mail

PHPMailer Sending Body As Text Attachment

I'm trying to set up a contact form for a client who wish to link the data from the form into their Goldmine system.
There is a 3rd party company who have sent me a sample contact form and a sample PHPMailer script, but when I test this script on the client's website it sends out the email, but as an attachment rather than in the body of the email.
I've looked at the PHPMailer script and I cannot see anywhere that references adding attachments so I'm puzzled as to whether there is something in the PHPMailer script I've not seen, or if this is some sort of server setting when the email is being sent? Any help would be appreciated.
The PHPMailer script has $Body which it just keeps adding each part of the form input to and then finally ends with what looks like the relevant bit of code to send the email:
ini_set("SMTP", Decode($SMTP));
if(mail(Decode($SendToEmail), $ToSubject, $Body, "From: GoldMine WebImport <no-reply#xxxxxxx>\r\nContent-Type: text/x-gm-impdata\r\n" )) {
print "Your data has been recorded successfully!\n\n<!--\n".Decode($SendToEmail)."\n".$ToSubject."\n".$Body."\n\n".$OutputAs."\n\n-->";
}
else
{print("There was a mailer failure.\n\n<!--\n".$Body."\n\n-->");}
}
else
{echo "There was no form data passed.";}
EDIT: I should also mention that I've been using Tectite's Formmail system for the same client on their existing contact forms and that sends the email with the content in the main body of the email as it is supposed to. I only seem to be having this problem with PHPMailer, but I can't use Formmail for sending the right info to the Goldmine system.

Website Booking Form does not send to email using php

ok i edited some of the code and the submit button does what i want it to do which is post my php file. However even if i get errors like i left a required field blank it will still submit the form now heres the new code i changed to
onSubmit: function(invalid, event) {
event.isDefaultPrevented();
if (invalid) {
} else {
$.post('save.php', this.$form.serialize(), function(response) {
// do something with response
}, 'json');
}
$('#invalid')
.show()
.toggleClass('valid', ! invalid)
.text(invalid ? (invalid +' invalid fields') : 'All good!');
}
});
How do i code this so that it only submits my form when there are no invalid fields
Dont use mail() function of php it will send your mail to junk only. Instead use SMTP php mailer function.
Why we should use SMTP instead PHP mail():
SMTP log in to an actual account on a mailserver and send the mail through SMTP to another mail server. If the mail server is configured correctly, your mails are sent from an actual account on a mailserver and will not wind up flagged as spam.
Mail sent with the mail() function is sent with sendmail in most cases. There is no authentication going on and it will almost always be flagged as spam if you use the "From:" in the extra headers.
This is because if you take a look at an original email file in say, gmail, you will see the headers that are sent. You are actually sending from user#serverhostname.tld and not someone#example.com like you had told the mail function to do.
If you use SMTP and view the original the email is actually sent from someone#example.com
You can download SMTP class from:
https://code.google.com/a/apache-extras.org/p/phpmailer/source/browse/trunk/class.smtp.php?r=170
http://www.phpclasses.org/package/14-PHP-Sends-e-mail-messages-via-SMTP-protocol.html
have you tried just
mail($email_to, $email_subject, $email_message, $headers);
also declare all your variables at top of page
$email seems not to be declared

Debug info from Symfony sfMailer regarding sending a mail

I need to log result of sending an e-mail message by sfMailer in Symfony 1.4
The message is to be sent when user submits a form which includes his contact e-mail address.
In case of failure (sending the mail) I should log his e-mail address using logger. That is pretty clear to me.
What I still don't get is how to get an "update" from sfMailer about whether the sending was success?
Something that returns true or false if possible.
Web debug toolbar is nice but it does not help here.
According to the doc:
When using send() the message will be sent just like it would be sent if you used your mail client. An integer is returned which includes the number of successful recipients. If none of the recipients could be sent to then zero will be returned, which equates to a boolean false. If you set two To: recipients and three Bcc: recipients in the message and all of the recipients are delivered to successfully then the value 5 will be returned.
Which result in:
// Send the message
$result = $mailer->send($message);
// or in a symfony action
$result = $this->getMailer()->send($message);

Categories