Page 1 of 1

Sending MAIL WITH IMAGES!

Posted: Mon Nov 02, 2009 9:31 am
by D_zone
Does anybody know any tutorial or anything about sending images, not as an attachment but as background to a mail?
I have this code, It send the message but not the image, weird as it is, it worked and then didn't work. It seems pretty simple, but it's not. Hope anybody could help.

Code: Select all

 
<?php
 
    $to  = "your@email.com";
    $subject = "Test ";
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
    $from = "Your name<new@noreplay.com>";
    $headers .= "From: {$from}";
    
    $body = "
    <html>
    <head>
    <title>Test HTML Mail</title>
 
</head>
    <body >
    <font color='blue'>This is an html Mail</font>
    <table border='0' width = '461' height ='160' bgcolor='gray' align='center' background='http://www.domain.com/image.jpg'>
    <tr>
    <td><img src='http://www.domain.com/image2.jpg'></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    </table>
    </body>
    </html> 
";
 
 
mail($to, $subject, $body, $headers);
?> 
 
:?: :?: :?: :?:

Re: Sending MAIL WITH IMAGES!

Posted: Tue Nov 03, 2009 10:03 am
by akuji36
Since the image is NOT being sent I believe css can help you.

For example , I have php installed on my server so I can use the php

mail function to sent mail. Since the page is from my site I

can simply style the background using css--

See the css background image property here:


http://www.tizag.com/cssT/background.php

thanks

Rod :D

Re: Sending MAIL WITH IMAGES!

Posted: Tue Nov 03, 2009 11:35 am
by D_zone
Thanks for replying akuji36,
I tried sending using css as well and didn't work either, like i said it worked only once where i finally saw the images in my mail box but it didn't last, it's weird.
I can color the background with no problem but the fact that I can't add images kills me.
Anybody has an idea why this happens?

Re: Sending MAIL WITH IMAGES!

Posted: Tue Nov 03, 2009 12:54 pm
by Eric!
It could be an issue with whatever program you're using for email. Why don't you create it in your email program and then view the raw mail file to see what it is doing.

Re: Sending MAIL WITH IMAGES!

Posted: Wed Nov 04, 2009 11:43 am
by D_zone
I am not so sure what you're saying Eric, I am sending these mails to a GMAIL,YAYOO accounts I have but don't get images into none of them.

Re: Sending MAIL WITH IMAGES!

Posted: Wed Nov 04, 2009 2:41 pm
by Eric!
There isn't a standard that says 'this is how every email program will display background images.' So in gmail make your message with the image the way you want it and send it to your server. Then you can disect the raw html and can copy what gmail does.