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


Email Turned into Attachment





ddukki
For some reason, when I use the PHP mail (); function, the email is sent, but the message is pushed into an attachment with no name. The message body is blank, also ...

Code:

$headers = "From: email@gmail.com\r\nReply-To: email@gmail.com";
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
   ob_start(); //Turn on output buffering
   ?>
   --PHP-alt-<? echo $random_hash; ?>
   Content-Type: text/plain; charset="iso-8859-1"
   Content-Transfer-Encoding: 7bit
   
   <? print $n_title."\r\n".$n_content; ?>
   
   --PHP-alt-<? echo $random_hash; ?>
   Content-Type: text/html; charset="iso-8859-1"
   Content-Transfer-Encoding: 7bit
   
    <html>
    <body>
    <table width="500px" cellpadding="2" cellspacing="0">
    <tr>
    <td style="styles">
    <? print $n_title." : By : ".$n_a; ?>
    </td>
    </tr>
    <tr>
    <td style="styles">
    <? print $n_content; ?><br />
    <a href="www.website.com">Go to the Site</a>
    </td>
    </tr>
    </table>
    </body>
    </html>
   
   --PHP-alt-<? echo $random_hash; ?>--
   <?
   $message = ob_get_clean();
   if (mail('mail@gmail.com', $n_title, $message, $headers))
   {
      $sent = 20;
   }
   else
   {
      $sent = 30;
   }

That's the code, with privacy elements changed. Now here's what I get in the attachment:

Code:

   --PHP-alt-de219c0680e4bfe3f84233ef8bc564f7
   Content-Type: text/plain; charset="iso-8859-1"
   Content-Transfer-Encoding: 7bit
   
   Email for the Masses
I\\\'m testing out the new email function, so if you guys get a weird email with junk in it, just disregard it.  If it has news in it, please actually read it!

Please reply to the mail if you do get the message guys!:wink:

[EDIT]
Argh, it didn\\\'t work.  I\\\'ll keep you guys posted on the progress.   
   --PHP-alt-de219c0680e4bfe3f84233ef8bc564f7
   Content-Type: text/html; charset="iso-8859-1"
   Content-Transfer-Encoding: 7bit
   
    <html>
    <body>
    <table width="500px" cellpadding="2" cellspacing="0">
    <tr>
    <td style="styles">
    Email for the Masses : By :     </td>
    </tr>
    <tr>
    <td style="styles">
    I\\\'m testing out the new email function, so if you guys get a weird email with junk in it, just disregard it.  If it has news in it, please actually read it!

Please reply to the mail if you do get the message guys!:wink:

[EDIT]
Argh, it didn\\\'t work.  I\\\'ll keep you guys posted on the progress.<br />
    <a href="www.website.com">Go to the Site</a>
    </td>
    </tr>
    </table>
    </body>
    </html>
   
   --PHP-alt-de219c0680e4bfe3f84233ef8bc564f7--

Which makes sense, but I want to know why it isn't in the message body. Is it a parsing issue?

BTW, I sent to gmail.

[EDIT]
Can someone move this to the scripting forums under PHP and MySQL?

[EDIT AGAIN]
Never mind. I figured it out eventually. Thanks to the viewers!
Related topics
free ipod type sites
"Hiding" Your Email Address from Bots
The 5 Golden Rules of Professional Design
Abortion: Yes or No?
South Park
Urls into variables
Recommended FREE/SHAREWARE Software
Ever Photoshopped something? Think again...
Hyderabad Bomb Blasts
What has our billboard 100 turned into?
Account locked when I changed email
The Sword of Truth just got turned into a TV series
books turning into movies- popularity
How to convert an Extended Partition into Primary
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

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