Mobile-Menu iFuturz Infoweb Inc. Contact Portfolio

09

Sep

How to set SMTP with Oscommerce ?

How to set SMTP with Oscommerce ?

Posted On : September 9, 2013

| No Comment

Following way we can setup SMTP to Oscommerce based web application

First of all go to admin panel ,

Configuration >> Email Option and Choose SMTP as Transport Method

Also Confirm other settings

Email Line Feels = LF

Use MIME EMail when sending email =YES

Verify E-Mail Addresses Through DNSĀ = FALSE

Use MIME HTML When Sending Emails= FALSE

Now we need to download phphpMailer package by following URL

(1) Download phphpMailer : http://sourceforge.net/projects/phphpMailer/

(2) There are two main files (a) class.phphpMailer.php(b) class.smtp.php

(3) Upload both files to following location using FTP
…/admin/includes/classes 

…/includes/classes/

(4) Now two files need to edit in oscommerce

/includes/classes/email.php

/admin/includes/classes/email.php

In the email.php locate this section: (line 519)

     if (EMAIL_TRANSPORT == 'smtp') {
        return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this-> lf . implode($this->lf, $$
        } else {
        return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this$
        }
        }

you need to comment out it and it will look like this

      if (EMAIL_TRANSPORT == 'smtp') {
        // return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $$
        // } else {
        // return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this$
        // }
        // }

 

then Copy and Paste following code below commented line.Make sure Host,Username and password fields should be match as per outgoing mail server.
At last sending mail using our system, use “locahost” as host and email address as then username

     require_once(DIR_WS_CLASSES . "class.phphpMailer.php");
        $phpMail = new PHphpMailer(); $phpMail->From = $from_addr;
        $phpMail->FromName = $from_name;
        $phpMail->IsSMTP();
        $phpMail->Host = "mail.yourdomain.com"; // replace with your smtp server
        $phpMail->Username = "email@yourdomain.com"; // replace with your smtp username (if SMTPAuth is true)
        $phpMail->Password = "password"; // replace with your smtp password (if SMTPAuth is true)
        $phpMail->SMTPAuth = true; // true/false - turn on/off smtp authentication
        $phpMail->Subject = $subject;
        $phpMail->Body = $this->output;
        $phpMail->AddAddress($to_addr, $to_name);
        $phpMail->IsHTML(false);
        return $phpMail->Send();
        $phpMail->ClearAddresses();
        $phpMail->ClearAttachments();
        }
        }

There is need to change in both email.php file for working correct.

  • Tags:

Comment