Help with PHP E-mail

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
Think-Digitally
Forum Commoner
Posts: 25
Joined: Wed Feb 04, 2004 2:25 pm

Help with PHP E-mail

Post by Think-Digitally »

Hi, how can you put graphics, like a header in an e-mail. I hear that most e-mail facilites use different scripting. Is there anyway you can use a php include?

thanks
Think-Digitally
Forum Commoner
Posts: 25
Joined: Wed Feb 04, 2004 2:25 pm

Post by Think-Digitally »

Nobody know?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

As long as they accept HTML in emails,

Code: Select all

<?php
$to = "email@domain.com";
$title = "Nice looking email";
$content = "<html><body><img src="server.com/pic.jpg" />Some text<br />More text..</body></html>";
$headers = "From: email@yourdomain.com";
mail($to,$title,$content,$headers);
?>
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

my somewhat formulaic answer is: http://phpmailer.sourceforge.net ;)
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

LiLpunkSkateR wrote:As long as they accept HTML in emails,

Code: Select all

<?php
$to = "email@domain.com";
$title = "Nice looking email";
$content = "<html><body><img src="server.com/pic.jpg" />Some text<br />More text..</body></html>";
$headers = "From: email@yourdomain.com";
mail($to,$title,$content,$headers);
?>
Actually, 7-bit encoding can be handy with HTML, header content-type is another important issue...
Think-Digitally
Forum Commoner
Posts: 25
Joined: Wed Feb 04, 2004 2:25 pm

Post by Think-Digitally »

Hi, thankyou for all your help. Although I do have a couple of questions, about the coding above.
What do I do to get the image, is it the website address and where the image would be, or would it be the path in ftp?
Also how can I make it so I can have an image in a form e-mail?

Thanks
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

it would be a URL (http://whatever.com/image.jpg) to the image
Post Reply