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 = n...@domain.ca, Reply-To = n...@domain.ca, 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: sudhee...@binaryvibes.co.in To: phps...@gmail.com CC: jfer...@hotmail.com; rich...@php.net; php-general@lists.php.net 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
RE: [PHP] Mail function and hotmail
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: jfer...@hotmail.com To: sudhee...@binaryvibes.co.in; phps...@gmail.com CC: rich...@php.net; php-general@lists.php.net 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 = n...@domain.ca, Reply-To = n...@domain.ca, 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: sudhee...@binaryvibes.co.in To: phps...@gmail.com CC: jfer...@hotmail.com; rich...@php.net; php-general@lists.php.net 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
Re: [PHP] Mail function and hotmail
On Wed, 2009-06-10 at 12:59 -0400, Fernando G wrote: Hello, I am sending an html message with and embedded image using the following code: // Read message from html template $message = fread(template.html, filesize(template.html)); // I replace the values in $message that are necessary to // fill the tempalte ... // Generate a boundary string $rand_value = md5(time()); $mime_boundary = -$rand_value; $headers = MIME-Version: 1.0\r\n; $headers .= From: Name n...@domain.com\r\n; $headers .= Reply-To: Name n...@domain.com\r\n; $headers .= Return-Path: n...@domain.com\r\n; $headers .= Organization: Name\r\n; $headers .= X-Mailer: PHP's mail() Function\r\n; $headers .= Content-Type: multipart/related; ; $headers .= boundary=\$mime_boundary\; type=\text/html\\r\n\r\n; $body = This is a multi-part message in MIME format.\r\n; $body .= --$mime_boundary\r\n; $body .= Content-Type: text/html; charset=UTF-8\r\n; $body .= Content-Transfer-Encoding: 7bit\r\n\r\n$message\r\n\r\n; $body .= --$mime_boundary\r\n; $body .= Content-Type: image/jpg\r\n; $body .= Content-Transfer-Encoding: base64\r\n; $body .= Content-ID: ggtourslogo\r\n\r\n; $body .= chunk_split(base64_encode(file_get_contents(./templates/emaillogo.jpg))); $body .= --$mime_boundary--; return mail(em...@domain.com, Subject, $body, $headers); However when it is send to a hotmail.com address the message is received blank. It does work fine with Gmail, Yahoo mail, Outlook Express and Thunderbird. Your help is much appreciated. Fernando _ We are your photos. Share us now with Windows Live Photos. http://go.microsoft.com/?linkid=9666047 As far as I'm aware, Hotmail blocks all images by default. Also, I've seen Outlook choke on message with the \r\n line endings, could Hotmail be doing that too? Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail function and hotmail
Hi, ... Use something that is already proven to work. It will save you an awful lot of time. -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 6th June) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail function and hotmail
I have not idea of what else to use. Your suggestions are appreciated. Fernando. Date: Wed, 10 Jun 2009 18:04:31 +0100 From: rich...@php.net To: jfer...@hotmail.com CC: php-general@lists.php.net Subject: Re: [PHP] Mail function and hotmail Hi, ... Use something that is already proven to work. It will save you an awful lot of time. -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 6th June) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Internet explorer 8 lets you browse the web faster. http://go.microsoft.com/?linkid=9655582
Re: [PHP] Mail function and hotmail
On Wed, Jun 10, 2009 at 1:11 PM, Fernando Gjfer...@hotmail.com wrote: I have not idea of what else to use. Your suggestions are appreciated. Fernando. Date: Wed, 10 Jun 2009 18:04:31 +0100 From: rich...@php.net To: jfer...@hotmail.com CC: php-general@lists.php.net Subject: Re: [PHP] Mail function and hotmail Hi, ... Use something that is already proven to work. It will save you an awful lot of time. -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 6th June) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Internet explorer 8 lets you browse the web faster. http://go.microsoft.com/?linkid=9655582 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 -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail function and hotmail
Hi, pear's mime mail I believe I had a hand in that too. It's like a bad rash - it gets everywhere... :-) -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 6th June) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail function and hotmail
Thanks. I'll check that out. Date: Wed, 10 Jun 2009 18:24:45 +0100 Subject: Re: [PHP] Mail function and hotmail From: rich...@php.net To: phps...@gmail.com CC: jfer...@hotmail.com; php-general@lists.php.net Hi, pear's mime mail I believe I had a hand in that too. It's like a bad rash - it gets everywhere... :-) -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 6th June) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp _ Internet explorer 8 lets you browse the web faster. http://go.microsoft.com/?linkid=9655582
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail function and hotmail
Thank you. I'm looking at PEAR Mail_mime right now. It seems promising. Fernando. Date: Wed, 10 Jun 2009 23:14:11 +0530 From: sudhee...@binaryvibes.co.in To: phps...@gmail.com CC: jfer...@hotmail.com; rich...@php.net; php-general@lists.php.net 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