RE: Mail function and hotmail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" => "name@xxxxxxxxx",
        "Reply-To" => "name@xxxxxxxxx",
        "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: sudheer.s@xxxxxxxxxxxxxxxxx
> To: phpster@xxxxxxxxx
> CC: jfercan@xxxxxxxxxxx; richard@xxxxxxx; php-general@xxxxxxxxxxxxx
> Subject: Re:  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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux