I found a lot of answer around stackoverflow.com but haven't helped me , so i am forced to ask
Problem:Phpmailer sending mails but Blank Emails! no body no attachment !
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "ssl://smtp.gmail.com"; // SMTP server
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 465; // set the SMTP port for the GMAIL server; 465 for ssl and 587 for tls
$mail->Username = "services@domain.xxx"; // Gmail account username
$mail->Password = "pwd"; // Gmail account password
//$mail->Mailer = 'smtp';
//Set who the message is to be sent from
$mail->SetFrom(service_mail_d, 'XXXX Services');
//Set an alternative reply-to address
$mail->AddReplyTo(service_mail_d, 'XXXX Services');
//Set who the message is to be sent to
$mail->AddAddress("testcenter@xxxx.xxxxx", "Client1");
//Set the subject line
$mail->Subject = "service_order_subject" ;
//Read an HTML message body from an external file, convert referenced images to embedded,convert HTML into a basic plain-text alternative body
$mail->MsgHTML("<h1>Simple TEST</h1>");
$mail->AddStringAttachment($generator_file_content,$generatorId ."html",'UTF-8','text/html');
//Send the message, check for errors
$mailSend=$mail->Send();
Update:
its sending mail and MsgBody can be seen if no StringAttachment is added !
Change the code from:
$mail->AddStringAttachment($generator_file_content,$generatorId ."html",'UTF-8','text/html');
//Send the message, check for errors
$mailSend=$mail->Send();
to:
$mail->AddStringAttachment($generator_file_content,$generatorId ."html");
// 'UTF-8','text/html');
if($mail->Send())
echo "Mail sent";
else
echo "Mail NOT sent";
The issue is your misunderstanding of the "encoding" parameter. This parameter does not indicate the encoding of the file, but the target MIME encoding for the file. From the documentation, you can use any of these values: