html an php problems

pwlovesrs used Ask the Experts™
i wanted to make a html program with a php which would convert the html into an email. but this time i want the php to convert images to an attachment, that would be sent to email. i know how to make the php that sends emails, but i wante d some attachments that would send images to email.
can anyone help?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
HainKurtSr. System Analyst

if it is mass email, why not creating email in HTML format and just give the links to images?

idea is a same as a web html page... but full url to image

Here is our new product!<br>
<a href=""><img src="" alt="Product of 2010"></a>
Richard QuadlingSenior Software Developer

I use RMail (previously known as htmlmimemail5 - available from

I use it to send HTML based reports which include embedded graphs (as images) and PDF attachments.

This class works great for me.


Construct your HTML message as normal.

Make sure that the image URLS are just the filenames, no paths - not essential, but certainly makes things a little easier.

Make sure the images are all in the same location and accessible by the PHP script - they do NOT have to be accessible over the web.

When you pass the HTML to the RMail class (using the setHTML() method), you pass 2 parameters.

The first is the HTML.

The second is the directory containing the images.

The class sorts out all the attachments and cid: values.

Richard QuadlingSenior Software Developer

HainKurt, one significant disadvantage to using web based URLs for images is that MS Outlook, by default, will NOT show the images.

By embedding the images, they are shown.

Using URLs to the images does mean you get the hit on the server every time anyone reads the message.

If you are supplying a handful of images to a thousand users, that's a LOT of hits.

By passing the images to the client, you don't have that headache.

PWLovesRS, keep the number of images to a minimum. Each image is encoded in a way that makes the size of the email bigger than just the number of bytes in the image file - excluding essential headers. The images are base 64 encoded to allow them to be expressed in 7 bits. This allows the email to pass to as many email clients as possible over as many SMTP networks as possible.

Essentially, it is the lowest common denominator.

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


no its not a mass email. its going to be sent to 1 email. but i need a php code to retrieve the file, convert to attachment then submit along with information on the form.


wow rqadling, you knew what my name meant. lol
Richard QuadlingSenior Software Developer

RQLovesSQ_HQ_TQ_OQ. I'm married with 3 kids.


lol. mine pw and rs
no kids


back to the subject, any help?
Senior Software Developer
Did you not read my posts?

$RMail = new RMail();

$RMail->setText('This is a HTML based email. Please you a better email client.');
$RMail->setHTML('Let us just pretend this is an HTML message with images like <img src="JustTheName.png" />', 'C:/Global/Images/Folder');

That's a REAL basic example - it won't work as is, but the principle is all there.

This is used everyday for hundreds of messages from our servers.

The messages also include PDF attachments.

Very very simple.

PHPMailer is another class which is probably more popular. I've never used it as RMail (well, the predecessor htmlmimemail5) was what I used first and never needed another one.


ok. thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial