Php Mailer embed image does not work

Asked

Viewed 157 times

1

I’m trying to send an image in the body of the email with php Mailer follows my Cod:

$mail->AddEmbeddedImage("img/header.jpg", "img1","header.jpg", "base64", "image/jpg");

and the html of the msg body is like this

<img src='cid:img1'>

nothing arrives even in gmail yahoo outlook. someone can help me?

1 answer

-2

place exactly where this located image :

$mail->AddEmbeddedImage("CAMINHO DO DIRETORIO 
    COMPLETO/img/header.jpg", 
    "img1","header.jpg", "base64", "image/jpg");

If using external HTML also put it exactly where it is located:

file_get_contents('CAMINHO DO DIRETORIO COMPLETO/mail_templates/ARQUIVO.html'); 

If nothing is coming, maybe it is the configuration of your SMTP, I recommend sendgrid.com as SMTP

  • guy didn’t work out :(*

  • I did so, without basis 64... $dirpath = '/Applications/XAMPP/xamppfiles/htdocs/email/phpmailer'; $message = file_get_contents($dirpath . '/mail_templates/email_send.html'); $mail->Addembeddedimage($dirpath . '/mail_templates/images/logo.gif', 'logo', 'logo.gif');

  • voi tentar ,but by security measures the server had to be internal.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.