How to send an image inside HTML mail (with attachment)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mandingueiro
Forum Newbie
Posts: 9
Joined: Fri Oct 03, 2008 6:46 pm

How to send an image inside HTML mail (with attachment)

Post by mandingueiro »

Hello people, what I want to do is to insert an image in an HTML email but not as an attachment neither as a remote image loaded from a url (with the <img> tag). I want to insert it just like the way you do it from Outlook, so they will be visible when someone reads the mail, and they dont have to open any attachment to view it.
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: How to send an image inside HTML mail (with attachment)

Post by The_Anomaly »

I'd imagine outlook uses the img tag when in HTML mode, we just don't see it?
mandingueiro
Forum Newbie
Posts: 9
Joined: Fri Oct 03, 2008 6:46 pm

Re: How to send an image inside HTML mail (with attachment)

Post by mandingueiro »

Well I made a mistake. I dont want to send html mail, I just want to send an email with and img attached to it, but I want the image to be displayed inline, just like you see it if you send yourself an email from outlook using the "Insert picture" option. Outlook uses something like a hidden-attachment technique to do this.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: How to send an image inside HTML mail (with attachment)

Post by Chris Corbyn »

Swift Mailer can do this. They're called embedded images ;)
mandingueiro
Forum Newbie
Posts: 9
Joined: Fri Oct 03, 2008 6:46 pm

Re: How to send an image inside HTML mail (with attachment)

Post by mandingueiro »

Thanks for the tip. Can you tell me a little more about this technique? Or in which file of your program can I find it?

Edit: Well I've found the technique you use. http://swiftmailer.org/wikidocs/v3/comp ... s_embedded
or here http://swiftmailer.org/wikidocs/v3/tuto ... ing_images

But how can I use this piece of code and insert it to my script so I make it work?
In my script by the way, I use mail() function combined with sleep(1) to send the mail to multiple recipient (inside a for).
Post Reply