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
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

mail

Post by ol4pr0 »

using mime mail. this ends up in junk..
plain text with a link ofcourse, this mail is send after a form has been submitted. my headers as below

Code: Select all

$hdrs = array(
			  'Content-Type' => 'multipart/alternative\r\n',
			  'Content-Type' => 'text/html; charset=iso-8859-1\r\n',
              'From'    => 'Support@--------------.com\r\n',
              'Subject' => 'Registro'
			  );
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Try using double quotes instead of single. \r and \n don't do what you expect inside single quotes, they need double quotes to turn them into carriage return & line-feed ;)
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Still no go. .it makes me go absolutely mad.. especially when u kno0w that outlook itself does send it out and wont end up in junk mail.

Code: Select all

$hdrs = array(
			  "Content-transfer-encoding"=> "8bit\r\n",
			  "Content-Type" => "text/html; charset=iso-8859-1\r\n",
			  "Return-Path" => "support@--------------.com\r\n",
			  "MIME-Version"=> "1.0\r\n",
              "From"    => "Support@-------------.com\r\n",
              "Subject" => "To Hoja de Vida Online\r\n"
			  );

#trying it all.. But.. GrrRRr
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

just to make sure:

you're imploding that array, in some fashion, to a single string for the mail function, correct?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

include('Mail.php');
include('Mail/mime.php');
$html = '<html><body>large chunk of text, <a href="domein.com/id?=91612131213">Gracias</a></body></html>';
$crlf = "\r\n";
$hdrs = array(
			  "Content-Type" => "text/html; charset=iso-8859-1\r\n",
			  "Content-Transfer-Encoding"=> "binary\r\n",
			  "Return-Path" => "support@---------.com\r\n",
			  "MIME-Version"=> "1.0\r\n",
              "From"    => "Support@----------.com\r\n",
              "Subject" => "To Hoja de Vida Online\r\n"
			  );

$mime = new Mail_mime($crlf);
$mime->setHTMLBody($html);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('-------@hotmail.com', $hdrs, $body);
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I don't know what the Mail_mime class is/does but this works ok :o

Code: Select all

<?php
$hdrs = array(
  'Content-transfer-encoding'=> "8bit\r\n",
  'Content-Type' => "text/html; charset=iso-8859-1\r\n",
  'Return-Path' => "support@wherever.com\r\n",
  'MIME-Version'=> "1.0\r\n",
  'From'    => "Support@wherever.com\r\n",
  'Subject' => "To Hoja de Vida Online"
);
$to = 'youremail@goeshere.com';
$message = 'A link <a href="http://www.google.com">google</a> here.';
$headers = '';
foreach($hdrs as $key=>$val){
  $headers .= $key.': '.$val;
}
mail($to, $hdrs['Subject'], $message, $headers);
echo 'Sent';
?>
It's not the cleanest way to do it but it works with your array format.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

i will try this.. back in a bit.. however what is the clean way.

I dont know but.. my hotmail just junks it..

my text and ure google example text.
i do not have my filter set to the max.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

it even junks this

Code: Select all

<html><body><p><body><div><font face="Arial" size="2"><div>Hola..</font></div></body></html>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Check Hotmail's specs if you can, it may require additional headers to make it valid.
Post Reply