0
Good afternoon, everyone,
I made a system that sends emails via Phpmailer from a client table in Mysql. So far so good, works perfectly. The problem occurs when I receive this email in MS Outlook online (outlook.com). The image appears with an icon as if the link to the same was broken or wrong. This also happens on the paid host, where this hosted my site, the image does not appear. How can I get around this problem?
Follow code I did. But note that works well in Gmail.
try{
$email = $mysql->where('send', 0)->get('cliente');
// Configutração Server Google Acount RCH - Itaipu
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.gmail.com";
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true;
$mail->Username = EMP_EMAIL;
$mail->Password = EMP_PASS;
$mail->From = EMP_EMAIL;
$mail->FromName = EMP_NAME;
$mail->WordWrap = 50;
$mail->IsHTML = true;
$mail->Subject = NEWS_SUBJECT;
$mail->AddCustomHeader("X-MSMail-Priority: 1");
$mail->AddCustomHeader("Priority: 1");
$mail->AddCustomHeader("Return-Receipt-To: EMP_EMAIL");
$mail->AddCustomHeader("X-Confirm-Reading-To: EMP_EMAIL");
$mail->AddCustomHeader("Disposition-Notification-To: EMP_EMAIL");
$mail->ConfirmReadingTo = EMP_EMAIL;
$message = "<html>";
$message .= "<body>";
$message .= "<div>";
$message .= "<img src='http://acma-development.epizy.com/acma/images/Progressiva_Itaipu.jpg'>";
$message .= "</div>";
$message .= "</body>";
$message .= "</html>";
$mail->msgHTML($message, __DIR__);
for ($i=0; $i < $mysql->num_rows(); $i++) {
$mail->addAddress($email[$i]['Email'], sentenceCase($email[$i]['Nome']));
if(!$mail->send()) {
echo "Mailer Error (" . str_replace("@", "@", $$email[$i]['Email']) . ")" . $mail->ErrorInfo . '<br />';
} else {
echo "Message sent to: " . $email[$i]['Nome'] . '(' . str_replace("@", "@", $email[$i]['Email']) . ')<br />';
try{
$mysql->where('ID', $email[$i]['ID'])->update('cliente', array('send' => '1'));
} catch(Exception $e) {
echo 'Caught exeception: ', $e->getMessage();
}
}
// Limpa todos os E-mail e anexospara o próximo loop
$mail->clearAddresses();
$mail->clearAttachments();
}
// Creating the email body to be sent
} catch(phpmailerException $e){
echo $e->errorMessage();
} catch(Exception $e){
echo $e->getMessage();
}
There would be double quotes inside the img in the src attribute?
"<img src=\"http://acma-development.epizy.com/acma/images/Progressiva_Itaipu.jpg\">";
– Kevin Kouketsu
Hi Kevin I’ll try but I don’t know if that’s it. But thanks.
– user152677
Hi Kevin, I have tested what I said above and it is still the same. Only in Outlook can not appear the image. In other Webmail everything works well.
– user152677
A little added the image I send in the body of the attached email, everywhere arrives well, only in Outlook that no!!!!
– user152677
Ah, is it just in outlook that it doesn’t work? I hadn’t understood that
– Kevin Kouketsu
This post can help you: https://stackoverflow.com/questions/3708153/send-email-with-phpmailer-embed-image-in-body
– Kevin Kouketsu
Hi Kevin, I tried to use this function and it didn’t work until I "talked" to the staff via github / phpmailer and with some help I changed my code enough to be more functional, is what is above. But I managed to put to work, in the post below has the solution. Hugs and thanks
– user152677