Jump to content

lee the bean

Members
  • Content count

    68
  • Joined

  • Last visited


Reputation Activity

  1. Thanks
    lee the bean got a reaction from oscMarket in Definitive PHPMailer Add-On / Instructions   
    Thank you Gergely. The subtle code changes in email.php allowed PHPMailer class to function just perfectly. I can now proceed to update to PHP 5.6
    So for anyone wanting a simple implementation guide here it is....
     
    The Definitive PHPMailer Install Instructions
    My Store    Store Owner                                      My Company
    E-Mail Address                                  my-email@mydomain.com
                               E-Mail From                                       my-email@my-domain.com
                              Send Extra Order Emails To:            my-email@my-domain.com
     
    E-Mail Options  E-Mail Transport Method                              smtp
                             E-Mail Linefeeds                                              LF
                             Use MIME HTML When Sending Emails       true
                             Verify E-Mail Addresses Through DNS          true
                           Send E-Mails                                                   true
     
    Download PHPMailer from https://github.com/PHPMailer/PHPMailer (current version 5.2.23) & upload to catalog/ext folder
     
    Backup email.php files
    Amend:
    admin/includes/classes/email.php           &
    /includes/classes/email.php                       (these two files are identical)
     
    Replace (around lines 519), or replace your Pear code:
     
          if (EMAIL_TRANSPORT == 'smtp') {
            return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers));
          } else {
            return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));
          }
        }
     
    With
     
          if (EMAIL_TRANSPORT == 'smtp') {
    //        return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers));
    //      } else {
    //        return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));
    //      }
    //    }
     
                require_once(DIR_FS_CATALOG . 'ext/PHPMailer/PHPMailerAutoload.php');
     
                $pMail = new PHPMailer();
                $pMail->IsSMTP();
                $pMail->IsHTML(true);
           
                $pMail->Host     = "mail.mydomain.com";
                $pMail->SMTPAuth = true;
                $pMail->Username = "myemail@mydomain.com ";
                $pMail->Password = "mypassword";
     
                $pMail->CharSet = "utf-8";
     
                $pMail->From = $from_addr;
                $pMail->FromName = $from_name;
                $pMail->addAddress($to_addr, $to_name);
                $pMail->Subject = $subject;
                $pMail->Body = $this->html;
                $pMail->AltBody = $this->text;
     
                if (!$pMail->Send()) {
                    return false;
                } else {
                    $pMail->clearAddresses();
                    $pMail->clearAttachments();   
                    return true;
                }
            }
         }
     
    Replace host, username and password values with your Authenticated SMTP parameters.
    Now all auto-generated emails from oscommerce will be sent with HTML, with a from address of    My Company <myemail@mydomwein.com>
    Emails sent via Tools -> Send Email, and newsletter emails will be send with HTML, with a from address of myemail@mydomwein.com.
     
    Once again, thank you Gergely.
×