Send image that is on the server as an email attachment

1

I need to send an email with folders (images) that are already on the server. Does anyone have an idea how to do this? Sending the email is already working. I'm using codeigniter and phpmailer.

    
asked by anonymous 19.10.2017 / 16:54

2 answers

1

There are a few ways.

The first is to have the image a public path of the server and only use the tag:

<img src="caminho/absoluto/imagem.png" />

It is also possible to add the image with PHPMailer itself using the AddEmbeddedImage method

link

$mail->AddEmbeddedImage('img/error.png', 'teste');

If I'm not mistaken you need to put a tag with the attached image id:

<img src='cid:teste'>

Abs

    
19.10.2017 / 16:59
1

Resolved , I've added this line:

$mail->AddAttachment("caminho_da_imagem/imagem.png");
    
20.10.2017 / 17:32