sending e-mails using php (more then just the mail function)

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
Jimeee_1999
Forum Newbie
Posts: 4
Joined: Tue May 28, 2002 8:33 am

sending e-mails using php (more then just the mail function)

Post by Jimeee_1999 »

I was wondering, is there a way of sending e-mails using php and make it send in HTML so the e-mail shows up in HTML. For example, when I use the mail function the only thing I can do with the message is seperate the lines with \n. I can't even bold or underline text (atleast I think I can't). I made a form using HTML and would like to send not only the information from the form but also something close to the format of the form to an e-mail. In other words, the e-mail would not show up only as a pile of information, but instead would show up as a filled out form.

Thanks for your help!

Jim
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

i'm pretty sure you could just do like

$what_to_send = "<html><body><b>$name</b><br />\n"
."Some other stuff: $somevar\n";

and just send it like that
icelord
Forum Newbie
Posts: 8
Joined: Sun May 19, 2002 9:19 pm

Try this

Post by icelord »

I think that this would help.

----------------------------------------------------------------------------

$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$headers .= "From: your_name<your_email>\n";
$mail = "<html><body>Enter your stuff here just like you would in a webpage, complete with all of the <b> tags,<br> tags and such</body></html>
$to = "some_email@someISP.com";
$subject = "Whatever";

//and then when you want to send mail just type in....

mail($to,$subject,$mail,$headers);

-----------------------------------------------------------------------------

There you go.... That should do it.....
Anthron
Forum Newbie
Posts: 8
Joined: Mon May 20, 2002 6:25 pm
Location: usa
Contact:

Post by Anthron »

like icelord said, you have to send a message in the header to tell the client that the email contains html.
Jimeee_1999
Forum Newbie
Posts: 4
Joined: Tue May 28, 2002 8:33 am

Post by Jimeee_1999 »

ahhhh i see thanks a bunch!
Post Reply