[Vtigercrm-commits] [vtiger development] #7325: Mail sent from CRM ends up in SPAM folder

vtiger development vtiger-tickets at trac.vtiger.com
Sat Jun 16 00:40:15 PDT 2012


#7325: Mail sent from CRM ends up in SPAM folder
------------------------+---------------------------------------------------
 Reporter:  prasad      |        Owner:  developer 
     Type:  defect      |       Status:  reopened  
 Priority:  unassigned  |    Milestone:  Unassigned
Component:  vtigercrm   |      Version:  5.3.0     
 Severity:  Medium      |   Resolution:            
 Keywords:              |  
------------------------+---------------------------------------------------
Comment (by prasad):

 Suggested Fix:

 '''includes/utils/CommonUtils.php'''
 {{{
 function getReturnPath($host, $from_email) {

         $returnname = 'info';
         $returnpath = $from_email;
         // Remove the trailing protocol information
         if (preg_match("/[^:]+:\/\/(.*)/", $host, $m)) {
         $host = $m[1];
         }
         // Remove the port address if any
         if (preg_match("/([^:]+):.*/", $host, $m)) {
         $host = $m[1];
         }
         // Remove any extra-spaces
         $host = trim($host);

         // Review if the host is not local
         if (!in_array(strtolower($host), array('localhost'))) {
         list($from_name, $from_domain) = explode('@', $from_email);

                 //strip [,] from domain name in case ip address is used as
 domain: xyz@[192.45.32.67]
                 preg_replace("/[\[\]]/",$from_domain,$from_domain);

                 // If from-email domain is not matching (or sub-domain) of
 host
         // reset the return-path
         if (strpos($host, $from_domain)== false) {
                         $from_domain = trim($from_domain);

                         if(preg_match(
 '/^((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))$/', $host)){
                                 $returnpath = $returnname . '@[' .
 $host.']';
                         }else{
                                 $returnpath = $returnname . '@' . $host;
                         }
         }
         }
 }
 }}}


 '''modules/Email/mail.php'''
 {{{
 $mail->Sender= getReturnPath($mail->Host, $from_email);
 }}}

 '''cron/send_mail.php'''
 {{{
 $mail->Sender= getReturnPath($mail->Host, $mail->From);
 }}}

 '''vtlib/Mailer.php'''
 {{{
 $this->Sender= getReturnPath($this->Host, $this->From);
 }}}

-- 
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7325#comment:3>
vtiger development <http://trac.vtiger.com/>
vtiger CRM



More information about the vtigercrm-commits mailing list