match_858 Posted July 16, 2010 Posted July 16, 2010 Dear all, This topic appears several times across the forum but with no apparent and definitive resolution. It doesn't appear to have been described fully by those suffering it's effects so I thought I'd try. I have several OSC sites for various customers, all with the same hosting provider but across different servers. One by one they appear to be 'upgrading' their servers sendmail requirements to reduce the possibility of them being used to send spam mail. This is resulting in all emails to admin and contact forms being stopped at the server. My hosting provider states that within the sendmail function the first parameter to mail is the address to which you want the form contents sent, in this case your own email address. The second parameter is the subject of the email message, the third is the content of the message, and the fourth is the "From" header so that you know who the sender is, and can reply. In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent([email protected]). My question is, how do I apply this to OSCs mail function? I've been attemping to apply it to includes/classes/email.php with no success and believe it needs to be applied in this section, but I'm stuck for ideas. /** * Sends the mail. */ function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') { if ((strstr($to_name, "\n") != false) || (strstr($to_name, "\r") != false)) { return false; } if ((strstr($to_addr, "\n") != false) || (strstr($to_addr, "\r") != false)) { return false; } if ((strstr($subject, "\n") != false) || (strstr($subject, "\r") != false)) { return false; } if ((strstr($from_name, "\n") != false) || (strstr($from_name, "\r") != false)) { return false; } if ((strstr($from_addr, "\n") != false) || (strstr($from_addr, "\r") != false)) { return false; } $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr); $from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr); if (is_string($headers)) { $headers = explode($this->lf, trim($headers)); } for ($i=0; $i<count($headers); $i++) { if (is_array($headers[$i])) { for ($j=0; $j<count($headers[$i]); $j++) { if ($headers[$i][$j] != '') { $xtra_headers[] = $headers[$i][$j]; } } } if ($headers[$i] != '') { $xtra_headers[] = $headers[$i]; } } if (!isset($xtra_headers)) { $xtra_headers = array(); } Your help would be appreciated, Matthew Heppiness Web Design - Web Design Bolton
Jan Zonjee Posted July 16, 2010 Posted July 16, 2010 My hosting provider states that within the sendmail function the first parameter to mail is the address to which you want the form contents sent, in this case your own email address. The second parameter is the subject of the email message, the third is the content of the message, and the fourth is the "From" header so that you know who the sender is, and can reply. In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent([email protected]). My question is, how do I apply this to OSCs mail function? I have it like this in the function send in includes/classes/email.php (bottom part shown, replace [email protected] with your own return address): 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), '-f [email protected]'); } else { return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers), '-f [email protected]'); } } /** * Use this method to return the email
match_858 Posted July 17, 2010 Author Posted July 17, 2010 Jan Many thanks for your time and remedy to my problem. It works perfectly. Matthew Heppiness Web Design - Web Design Bolton
Silver Sailor Posted July 27, 2010 Posted July 27, 2010 I have it like this in the function send in includes/classes/email.php (bottom part shown, replace [email protected] with your own return address): 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), '-f [email protected]'); } else { return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers), '-f [email protected]'); } } /** * Use this method to return the email
Silver Sailor Posted July 27, 2010 Posted July 27, 2010 Help. I altered the email.php file as you suggested and now I can't get my catalogue back. I get the following message: Parse error: syntax error, unexpected T_ELSE in /home/silvgem/public_html/silversailors.net/includes/classes/email.php on line 520 What have I done wrong? I checked and double checked that I entered it ok.
Jan Zonjee Posted July 27, 2010 Posted July 27, 2010 What have I done wrong? I checked and double checked that I entered it ok. How should we know? Apparently you didn't enter it right. You could go back to your backup (of course you have one) and then only change the two lines that start with return mail. Another thing that might be wrong is that you picked up UTF-8 white spaces when copying and pasting code. Depending on OS and text editor you use there are different options to save the file again as ASCII or iso-8859-1.
catch Posted November 20, 2010 Posted November 20, 2010 hello match_858 I will ask you, its still working for you? and can I be 100% sure that the server will delivery/send mail every time with this script? or can I risked the server sees it as spam and block against this script an no sent the mail? Beclouse is food shopping online delivery, so it is very important that the mail be sent to the fax service so we can receive it in the store very quickly be fax mashin. Hope to hear from you. thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.