How to send an image to a newsletter?

can someone tell me how i can send images as the main body part in the newsletter. how can I add any image from the backend, so when I send the newsletter to subscribers, the image I want to display is the main part of the mail.

In fact, what I'm saying, I have a form in which I can enter text, and this text goes well in the newsletter. Now I want to add images to the form, so I don’t need to write anything, and only the image will be mailed as the main part of the mail.

Thank you very much. you guys were very supportive of me.

+6
php email newsletter
source share
4 answers

If your newsletter is in HTML format, just click on the link to live images that are on the server.

If you do not have your own server, simply place the images in any form of free image hosting, that is (imageshack.us), and in the body of the message add:

<img src="http://imageshack.us/myimage.png"> 

And when the user opens the email, the images will be downloaded from the server.

As long as the email is multi-part (as suggested earlier), any users who are "unable to read" the HTML will receive a text version, which may have "hard links" to the images on your real server.

Hope this helps you

+7
source share

First, you need to send your newsletter in HTML format. You can then paste the image into your newsletter as

 <img src="image_url"> 

image_url may be remote or inline. A remote image reduces email, but most email clients request user approval. The embedded image will be displayed without a user request, but it will be part of the email.

To use a remote image, just place the image somewhere and put the URL as image_url.

The embedded image must be encoded as part of the MIME. It is not so difficult. You need to use a package like PhpMailer,

http://sourceforge.net/projects/phpmailer/

Here is an example

 <?php require("class.phpmailer-lite.php"); $mail = new PHPMailerLite(); $mail->From=" you@example.com "; $mail->FromName="Your Name"; $mail->AddAddress(" list@example.com "); $mail->Subject = "Your fancy newsletter"; $mail->IsHTML(true); $mail->AddEmbeddedImage('image.png', 'image_id', 'test.png', 'base64', 'image/png'); $mail->Body = <<<EOT <h1>My Newsletter</h1> <p>This picture is embedded in newsletter: <img src="cid:image_id" /></p> EOT; $mail->AltBody="Text only, sorry no image"; if(!$mail->Send()) { echo "Error sending: " . $mail->ErrorInfo; } else { echo "Mail is sent"; } ?> 
+6
source share

You should create a multi-user mime message containing an image and possibly some HTML.

+2
source share

I would not recommend attaching images to e-mail .... this is one of the many flags for the email service providers that you send spam. It is best to do, as indicated in the Marcos solution, and a link from another server at an absolute URL. Remember also to avoid the obvious emails you get under the black flag. Raising the flag with a spam filter requires only one dubious email that will aggressively inform you of RBL. And believe me, it is not funny to get out of these lists!

My company sends tens of thousands of letters daily on behalf of our customers. We tried to implement it at one point for the test and found that more than 50% of our emails were either unreachable or lost in the "big chasm" of spam filtering. Thanks to the binding, we provide delivery of more than 85%, depending on the quality of the emails provided.

+2
source share

All Articles