i am trying to send out an email which contains images from a database of images that have been uploaded. when i send the email out only the text and any images that have been hard codeing in using the img tag.

i have done some research on this and i have found out that i need to display the images using the absolute path to them but i do not know how to do this.

i found some code to print out the absolute path to where the images is being dstored in the database but how do i then use this path to display the images within the email?

Recommended Answers

All 6 Replies

You can't 'display' an image in an email. You can however attach a file to an email and send that. However that is not a MySQL topic. You would be better in a forum for the language you are using to do this in.

it is possible to display images in an email i have already got some of them to display on the email that is being sent out but none of the images from the databases will display within the email.

to gat images to display within the email then the absolute paths must be used for the images and they will display. to get an image to display using the absolute path the the code looks some thing like this

www.yourdomain.com/images/image1.jpg

i have used this code to get the absolute path of the images bing stored in the database

$path = getcwd();
echo "The absolute path to this directory is: ";
echo $path;

and this prints out the absolute path to the directory where the mysql table is stored i now need to know how to use this path to get the images to display from the server when the email is sent out.

it is possible to display images in an email i have already got some of them to display on the email that is being sent out but none of the images from the databases will display within the email.

to gat images to display within the email then the absolute paths must be used for the images and they will display. to get an image to display using the absolute path the the code looks some thing like this

www.yourdomain.com/images/image1.jpg

i have used this code to get the absolute path of the images bing stored in the database

$path = getcwd();
echo "The absolute path to this directory is: ";
echo $path;

and this prints out the absolute path to the directory where the mysql table is stored i now need to know how to use this path to get the images to display from the server when the email is sent out.

You are correct. In this case the message has to be sent as HTML.
Use

Content-Type: multipart/mixed;

this is were my problem lies though. i have been able to hard code images in to the html code and send this out as an email newsletter but when the images from the database are used they do not show up on the email.

i have set the page up once with all the images coded in using the img tag and it works i need to be able to recall the images from the database and send them out in the email with the absolute path attached to them so that when the email is opened it knows to look on the server were they are held to retrieve the image and display it correctly in the email.

In order for your images to be available via a web link, they have to be in the 'public' tree of your web server. Think of where you put images to be displayed on a web site. The images you want to send in the email have to be under that same tree.

But this isn't really a MySQL question. It is more of a server / CGI question.

thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.