jkuruppu Posted May 19, 2008 Share Posted May 19, 2008 I know that my server requires the "-f" switch to be set in additional params for sendmail to function, but i'm striking out finding the line of code to alter to make this happen. so far, i've tried the following, without success (using the "Contact Us" from the main catalog page to test): /catalog/includes/classes/email.php 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]")); } and below, using the email to customers from the admin panel to test: /catalog/admin/mail.php //Let's build a message object using the email class $mimemessage = new email(array('X-Mailer: osCommerce')); // add the message to the object $mimemessage->add_text($message); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], $from, $subject, "-f [email protected]"); } i haven't found anything on this in the forums, although I do wonder if it might be the solution for others having trouble with sendmail?? Link to comment Share on other sites More sharing options...
jkuruppu Posted May 19, 2008 Author Share Posted May 19, 2008 well, i was hoping that what i found on this contribution: fix emails bounced due to return path would help me out, since i think i was altering the wrong files. i made the following edit to both /catalog/admin/includes/functions/general.php /catalog/includes/functions/general.php // Send message $message->build_message(); $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, 'Return-Path: <' . $from_email_address . '>', '-f ' . $from_email_address); and also like this: // Send message $message->build_message(); $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, 'Return-Path: <' . $from_email_address . '>'); but no luck either way. :( i feel like i'm so close - any help anyone??? Link to comment Share on other sites More sharing options...
jkuruppu Posted May 19, 2008 Author Share Posted May 19, 2008 OK, i got it!!! hope this may help someone else... i came across E-Mail Testing Script, submitted way back in 2003 by Harald Ponce de Leon!! unfortunately, it doesn't necessarily say what to do with the results. so, if i run the email_test.php that i uploaded from that contribution to my site, the test generates one email only which had [oscommerce] in the subject line, which i assume means that the osCommerce class for sending emails is working - and that was when i had the following modification in the file /catalog/includes/classes/email.php: 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, '-f ' . $from_addr)); } and, then i realized that i had to add the -f switch to the code in the email_test.php file as well, which now reads: if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'send')) { mail($HTTP_POST_VARS['to_address'], '[PHP] ' . $HTTP_POST_VARS['subject'], 'This email has been sent from the native php mail() function.' . "\n\n" . $HTTP_POST_VARS['body'], null, '-f ' . $HTTP_POST_VARS['from_address']); Link to comment Share on other sites More sharing options...
jkuruppu Posted May 21, 2008 Author Share Posted May 21, 2008 one additional discovery - for anyone to whom this issue applies: you have to make the same edits to the file: /catalog/admin/includes/classes/email.php o/w the admin section won't send out emails (which includes the order confirmation emails, and newsletters) Link to comment Share on other sites More sharing options...
Hairyharry Posted May 21, 2008 Share Posted May 21, 2008 one additional discovery - for anyone to whom this issue applies: you have to make the same edits to the file: /catalog/admin/includes/classes/email.php o/w the admin section won't send out emails (which includes the order confirmation emails, and newsletters) I have the same problem. I've applied the code changes you give above but they have not helped. Any more insights to this problem. Thanks.......henry Link to comment Share on other sites More sharing options...
jkuruppu Posted May 21, 2008 Author Share Posted May 21, 2008 I have the same problem. I've applied the code changes you give above but they have not helped. Any more insights to this problem. Thanks.......henry my mistake!! i made a slight error. the -f switch param needs to be outside the ')' that closes the implode line the correct code should be: 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), '-f ' . $from_addr); } note the subtle difference in the last line: WRONG: implode($this->lf, $xtra_headers, '-f ' . $from_addr)); CORRECT: implode($this->lf, $xtra_headers), '-f ' . $from_addr); (i've highlighted the parenthesis in red) another thing - depending on how you have your email set, you may not be able to use the $from_addr variable, but may need to specify it in the code, as in ", -f [email protected]" good luck, janaki Link to comment Share on other sites More sharing options...
Hairyharry Posted May 21, 2008 Share Posted May 21, 2008 my mistake!! i made a slight error. the -f switch param needs to be outside the ')' that closes the implode linethe correct code should be: 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), '-f ' . $from_addr); } note the subtle difference in the last line: WRONG: implode($this->lf, $xtra_headers, '-f ' . $from_addr)); CORRECT: implode($this->lf, $xtra_headers), '-f ' . $from_addr); (i've highlighted the parenthesis in red) another thing - depending on how you have your email set, you may not be able to use the $from_addr variable, but may need to specify it in the code, as in ", -f [email protected]" good luck, janaki Brilliant - now working fine. Thanks for the help. Henry Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.