phpmailer – The following SMTP Error: Data not accepted
your server dosen’t allow different sender and username you should config: $mail->From like $mail->Username
your server dosen’t allow different sender and username you should config: $mail->From like $mail->Username
I believe port 25 is blocked on smtp.live.com. I cannot connect to smtp.live.com:25 from here either. Try using port 587 instead, with TLS. So, it would be: $mail->Port = 587; $mail->SMTPSecure=”tls”;
Here is a working example: require_once ( ‘class.phpmailer.php’ ); // Add the path as appropriate $Mail = new PHPMailer(); $Mail->IsSMTP(); // Use SMTP $Mail->Host = “smtp.gmail.com”; // Sets SMTP server $Mail->SMTPDebug = 2; // 2 to enable SMTP debug information $Mail->SMTPAuth = TRUE; // enable SMTP authentication $Mail->SMTPSecure = “tls”; //Secure conection $Mail->Port = 587; … Read more
Following the reusability principles, you can use https://github.com/PHPMailer/PHPMailer <?php require ‘PHPMailerAutoload.php’; $mail = new PHPMailer; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host=”smtp1.example.com;smtp2.example.com”; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username=”jswan”; // SMTP username $mail->Password = ‘secret’; // SMTP password $mail->SMTPSecure=”tls”; // Enable encryption, ‘ssl’ also accepted $mail->From = … Read more
Change $mail->MsgHTML(); to $mail->Body; Source: here
You need to call: $mail = new PHPMailer(true); // with true in the parenthesis From the documentation: The true param means it will throw exceptions on errors, which we need to catch.
In PHP mailer, you need to set below $mail->IsHTML(true); Note: $mail means your PHPMailer object. Reference Link: PHPMailer
AddStringAttachment($string,$filename,$encoding,$type) eg $mail = new PHPMailer(); $mail->AddStringAttachment($string,$filename,$encoding,$type); https://phpmailer.github.io/PHPMailer/classes/PHPMailer-PHPMailer-PHPMailer.html#method_addStringAttachment
You can use clearAllRecipients( ) $mailer->clearAllRecipients( ); // clear all
Based on you code i notice that you are sending an email directly from you web page on your domain. For example you used an @hotmail.com address. When the recipient receive the emails the mail service of the recipient may test a reverse DNS of the sender of the mail. So the sender is from … Read more