I decided to change the call to send to:
$mail =& Mail::factory("smtp", array("host" => "localhost"));
return $mail->send($params["email"], $headers, $body);
and now hotmail wokrs. Maybe qmail changes something when the mail() function
is used.
Thank you for all your help.
Fernando.
> From: [email protected]
> To: [email protected]; [email protected]
> CC: [email protected]; [email protected]
> Date: Thu, 11 Jun 2009 10:34:13 -0400
> Subject: RE: [PHP] Mail function and hotmail
>
>
> Hello, Thank you all for your cooperation yesterday. I tried PEAR Mail_mime
> as follows:
>
> function SendEmail($template, $params){
> // Read and open the template file and the image file
> $htmlFile = fopen("./templates/$template.html", "r");
> $txtFile = fopen("./templates/$template.txt", "r");
> $htmlMsg = fread($htmlFile, filesize("./templates/$template.html"));
> $textMsg = fread($txtFile, filesize("./templates/$template.txt"));
>
> // Replace the template values
> foreach($params as $key => $value){
> // Template values will always start with two hash marks ##
> if(substr($key, 0, 2) == "##"){
> $htmlMsg = str_replace($key, $value, $htmlMsg);
> $textMsg = str_replace($key, $value, $textMsg);
> }
> }
>
> // Create the appropiate headers
> $headers = array(
> "From" => "[email protected]",
> "Reply-To" => "[email protected]",
> "Subject" => $params["subject"],
> "Organization" => "Name"
> );
>
> // Create the mime object
> $mime = new Mail_mime();
> $mime->setTxtBody($textMsg);
> $mime->setHTMLBody($htmlMsg);
> $mime->addHTMLImage("templates/emaillogo.jpg", "image/jpg",
> "templates/emaillogo.jpg");
>
> // Set the variables for the Mail object to send the message
> $body = $mime->get();
> $headers = $mime->headers($headers);
>
> $mail =& Mail::factory("mail");
> return $mail->send($params["email"], $headers, $body);
> }
>
>
> However, hotmail is still getting blank emails when I sent them from my
> production machine (CentOS 5.3), however, when I send the message from my
> development machine (Visata Ultimate SP1) it does work correctly on hotmail
> address . Both machines are running php 5.2 and have the same PEAR packages.
> I tried Gmail, Yahoo mail and Thunderbird and they work fine.
>
> Your help will be much appreciated.
>
> Thank you,
>
> Fernando.
>
> > Date: Wed, 10 Jun 2009 23:14:11 +0530
> > From: [email protected]
> > To: [email protected]
> > CC: [email protected]; [email protected]; [email protected]
> > Subject: Re: [PHP] Mail function and hotmail
> >
> >
> > >
> > > Richard was likely suggestion his mail example as listed in his signature
> > >
> > > Other options include
> > >
> > > phpmailer
> > > pear's mime mail
> > >
> > > various other classes available www.phpclasses.org
> > >
> > Fernando,
> >
> > I recommend you check out the various PHP frameworks out there. Instead
> > of randomly searching for classes for common functionality like sending
> > an email from your script, you could use the framework's classes. I am
> > sure all of the frameworks provide classes to send emails. The next
> > time you need a class to read email from your scripts, you can simply
> > look for classes your framework of choice provides.
> >
> > I personally use Zend Framework. But there are many available - Cake,
> > CI, Symphony, etc.
> >
> > Also take a look at PEAR like Bastien said.
> > --
> >
> > With warm regards,
> > Sudheer. S
> > Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net,
> > Personal: http://sudheer.net
> >
>
> _________________________________________________________________
> Attention all humans. We are your photos. Free us.
> http://go.microsoft.com/?linkid=9666046
_________________________________________________________________
We are your photos. Share us now with Windows Live Photos.
http://go.microsoft.com/?linkid=9666047