Two problems with 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
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Two problems with mail function.

Post by amir »

I have two problems with mail.

1.) When i receive a mail in outlook i see the html format with the message
example : (<tr><td>Hi this is tha mail you asked for....</td></tr>)

2.) I cant receive anything in hotmail.
Should i add something more to the header section ? Why hotmail reject my mails ?
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
I use this :

Code: Select all

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8888-8\r\n";
$headers .= "Email from http://www.example.com \r\n";

$message = '
<html>
<body>
<table align=center width=50%>
<tr>
  <td>Example</td>
</tr>
</body>
</html>';

$to=$_POST['youremail'];
$subject = $_POST['theme'];

...
mail($to, $subject, $message, $headers);
...
Thanks in advance :)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Does it have to be a self-tinkered script using php's mail()?
If not there are many scripts/classes that can help you to create valid mime mails.
phpmailer, swiftmailer even got its own forum here on the board, pear classes ...make your choice.
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Post by amir »

Thanks for your reply. I 'll certainly try them. :)
Post Reply