FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Can You Get HTML in Your PHP Mail Script?





moejoe
Hey.

Does this Server Support PHP with mail HTML?

I can't get it to work.

Heres my Code.

Code:
mail('webmaster@xx.com', 'Subject',
                         '<body>

My HTML Email HEre!
</body>',
                         "To: $Reciever\n" .
                         "From: $sendersname <$sender>\n" .
                         "MIME-Version: 1.0\n" .
                         "Content-type: text/html; charset=iso-8859-1");


Thanks for any Help.
raver
ofcourse it supports sending html messages. The only thing you have to be careful is escaping special characters like " ' and so on. If you accidentaly let one in it will break the string. ALso, it would help if you could post an error message if you received one.
Check out the functions addslashes() and stripslashes() which can help you with escaping and reverting the text to it's former state Smile
TomS
Hm. Can't find anything wrong in this code.
Try to use >>"<< instead of >>'<<
And cut your variables out of the string. I know php should accept it, but on my Apache is doesn't properly. So I use to write
Code:
echo "Hello Mr. ".$VAR." How are you?";
bladesage
moejoe wrote:
Hey.

Does this Server Support PHP with mail HTML?

I can't get it to work.

Heres my Code.

Code:
mail('webmaster@xx.com', 'Subject',
                         '<body>

My HTML Email HEre!
</body>',
                         "To: $Reciever\n" .
                         "From: $sendersname <$sender>\n" .
                         "MIME-Version: 1.0\n" .
                         "Content-type: text/html; charset=iso-8859-1");


Thanks for any Help.


You sure can!

First off, you are not separating your headers properly. Each header must be separated with "\r\n", just a newline character isn't acceptable to the browser/e-mail host. So you must always add a carriage return (\r) and a newline (\n) between headers.

Now then, as for why it doesn't work when you do have those headers...I would first suggest that you don't put so many carriage returns in the strings. Instead, you should compile the string into a variable, which can then be mailed out.

Simply use something like
Code:
$message = "<body>\n\nMy HTML Email Here!\n</body>";


Or, you can use the . operator to continue appending data to the variable. The big question here is what goes wrong? Do you get an error message? If so, what does it say? Or do you receive the e-mail, but see nothing at all, or the tags right there? Do you just not get the email?

Hope I could help somehow.

PS: For more detailed information, visit the php.net mail() function page.
moejoe
I Hate MSN...

Seems that they have Blocked My Little Scripts from there lovely server.
Great...

Works Fine with my ISP email.
Thanks V.Much for that Laughing Laughing Laughing Very Happy

So; Does anyone know how to Screw MSN... Laughing
bladesage
moejoe wrote:
I Hate MSN...

Seems that they have Blocked My Little Scripts from there lovely server.
Great...

Works Fine with my ISP email.
Thanks V.Much for that Laughing Laughing Laughing Very Happy

So; Does anyone know how to Screw MSN... Laughing


I do, but I've been caught hacking too much already...
moejoe
Haha, Laughing

Is there a xtra header tag you can input to make it MSN accepted?

If you can; Could u PM me the script?

Thanks!
avk
Hey! For the mailing thing.. I think that php.net would be the best.

Here is the link.

Read this.. This got all u need.

http://www.php.net/manual/en/function.mail.php
moejoe
Hey,

Thanks For The Link.

Again, the method set in PHPnet Does not work with MSN?..Why!?

The only times it seems to send my email is when it is sent from [Server] which i do not want because it'll only end up in the Junk Mail.

Is there any additional Headers that i may need so that Msn will accept my script?

Thanks.
moejoe
Tested:

Works Very Well With Yahoo.

MSN still Has Problem.

Please HelP!.
Related topics
Hot or Not PHP-Nuke script
What's the best PHP Wiki script?
php mail and BCC
Looking for easy FormMail Script
Php voting script needed (URGENT)
PHP mail function ?
Does FriHost support php mail?
Php mail function
how did you learn about html, php or other languages???
PHP Mail
PHP contact script...
PHP Mail - Always Junked?
Need a Contact form from HTML/PHP
need help in a simple php register script based on flat file
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.