pwlovesrs
asked on
html an php problems
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?
can anyone help?
I use RMail (previously known as htmlmimemail5 - available from http://www.phpguru.org/static/Rmail)
I use it to send HTML based reports which include embedded graphs (as images) and PDF attachments.
This class works great for me.
So.
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.
I use it to send HTML based reports which include embedded graphs (as images) and PDF attachments.
This class works great for me.
So.
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.
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.
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.
ASKER
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.
ASKER
wow rqadling, you knew what my name meant. lol
RQLovesSQ_HQ_TQ_OQ. I'm married with 3 kids.
ASKER
lol. mine pw and rs
no kids
no kids
ASKER
back to the subject, any help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok. thanks
idea is a same as a web html page... but full url to image
Here is our new product!<br>
<a href="http://www.products.com/prd/2010.php"><img src="http://www.products.com/prd/images/2010.jpg" alt="Product of 2010"></a>