Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

customers and emails


Guest

Recommended Posts

Posted

Hia.

 

My emails to my customers are being sent out as [email protected], and my host has email from nobody@whatever. blocked to reduce spam attacks.

 

Everthing else is fine, I get mails, contacts mails ok, settings checked and checked again. Customers get no mail.

Tested the email test contrib and still no good.

 

My "Sent From" address in admin is me@mysite, so how come, and how can I change if possible, nobody@mysite to me@mysite, as the admin screen sez.

 

 

my server admin will not change the nobody block, for good reasons.

 

I'm on sendmail, extra mails = true, sent from and send to = same address, linefeed = on, html = off,dns= off.

 

sendmail path ok, mails declare sent to customer.

 

I've stripped the <name> part out of the admin email config box, checked for white spaces as per forum discussions.

 

In the end contacted the admin on the server side, and the logs show the nobody@mysite info.

 

hope this is helpful fo other email enquirers who have all the settings right, but still cant send mails to customers.

 

I spent a few hours in various forums etc before posting this, so a linky to a solution, if I've missed it, would be also much appreciated.

 

I've also read advice here about some odd bits of code to insert into configure.php (I think it was) file as to perhaps cure this, however i might have got lost at that point. even so problem still not fixed....

 

thanks for this forum, I've found it a great source of info, but with this I'm stuck.

 

regards

Posted

Open up catalog/includes/classes/email.php

 

Search the file for EMAIL_TRANSPORT (near the bottom of the file)

 

replace the if..else section with this

 

  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".STORE_OWNER_EMAIL_ADDRESS);
 } else {
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers),"-f".STORE_OWNER_EMAIL_ADDRESS);
 }

 

I found this on the board somewhere before but couldn't find the post so I dug it out from my files.

Posted
Open up catalog/includes/classes/email.php

 

Search the file for EMAIL_TRANSPORT (near the bottom of the file)

 

replace the if..else section with this

 

  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".STORE_OWNER_EMAIL_ADDRESS);
 } else {
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers),"-f".STORE_OWNER_EMAIL_ADDRESS);
 }

 

I found this on the board somewhere before but couldn't find the post so I dug it out from my files.

 

Thanks, i'll give it a go, will this work with sendmail? or is it just smtp. I have the smtp contrib loaded as well, i guess i'd better see if this code is already there. I'll try to set up smtp again maybe, and find a server to send through (i'd prefer it to be by the server I'm on really).

 

Not sure where I'm going with this, I have smtp running on the server for my email account with it from home, it runs sendmail too internally......... I've tried to set it up with the smtp contrib and without, and with tcpip on a smtp server somewhere else on the internet too. (why?)

I wasn't sure which server to use, externally, so I chose another of my own at a different domain on the same provider and the own from my home account ISP thinking it might not require authentication so i could leave that bit out.

 

I have got a bit confused, but I'm hanging in there, I'm a complete newbie to oscommerce, but willing to learn and share.....I'm getting this feeling that i'll end up somehow with smtp, and php with sendmail will be dead, due to security issues.

 

I'll check code and post back.

 

Thank you.

Posted

OK here's my email.php, from the smtp contrib that provides authentication (optionally). I think this does the same job, but i'm not sure.

 

 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();
     }

     // Hack in SMTP based email transport
     if (EMAIL_TRANSPORT == 'smtp') {

include_once(DIR_WS_CLASSES . 'class.smtp.php');

// Build up the SMTP connection parameter list
$params['host'] = EMAIL_SMTP_HOST_SERVER; // The smtp server host/ip
$params['port'] = EMAIL_SMTP_PORT_SERVER; // The smtp server port
$params['helo'] = EMAIL_SMTP_HELO_SERVER; // helo/ehlo command string; typically your domain/hostname
$params['auth'] = EMAIL_SMTP_ACTIVE_PASSWORD; // Whether to use basic authentication or not
$params['user'] = EMAIL_SMTP_USERNAME; 	// Username for authentication
$params['pass'] = EMAIL_SMTP_PASSWORD; 	// Password for authentication

// Prepare the recipient names; there can be multiple recipients in the to_addr seperated by a comma.
       // Create an array of the recipients and then strip off everything and just leave the internet style
       // email address behind. For example: "MyCuteName <[email protected]>" => "[email protected]"
       $recipients = explode(',', $to_addr);
       for ($i = 0; $i < count($recipients); $i++) {
          $recipients[$i] = trim(preg_replace( '/(.*)<(.*)>(.*)/', '$2', $recipients[$i]));
       }
$send_params['recipients'] = $recipients;

// Timestamp the message
$date = date('r');

$send_params['headers'] = array_merge($this->headers, array("From: $from", "To: $to", "Subject: $subject", "Date: $date"));

// This is used as in the MAIL FROM: cmd
// It should end up as the Return-Path: header
$send_params['from'] = $from_addr;

// The body of the email message
$send_params['body'] = $this->output;

//Send the email via SMTP
return (is_object($smtp = smtp::connect($params)) AND $smtp->send($send_params));

     } else {
       return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));

Posted

Ok tried to send through a smtp server I have access to, with user permissions etc set up ok, this comes back from all smtp remote servers too anyway so far......this with the smtp contrib as supplied to provide authentication extras.

 

Warning: fsockopen() [function.fsockopen]: unable to connect to xxxx.xxxxxx.co.uk:25 (Connection refused) in xxxx/xxxxxx/public_html/catalog/includes/classes/class.smtp.php on line 102

 

Warning: fsockopen() [function.fsockopen]: unable to connect to xxxx.xxxxxx.co.uk:25 (Connection refused) in xxxx/xxxxxx/public_html/catalog/includes/classes/class.smtp.php on line 102

 

Warning: Cannot modify header information - headers already sent by (output started at xxxx/xxxxxx/public_html/catalog/includes/classes/class.smtp.php:102) in xxxx/xxxxxx/public_html/catalog/includes/functions/general.php on line 33

Posted

I only send via sendmail. I did not realise from your post that you were trying to use SMTP.

Posted
I only send via sendmail. I did not realise from your post that you were trying to use SMTP.

 

 

I'm not "using" either, as at mo neither work......I want to use sendmail, really, not smtp.

 

The reason I asked you if the additions you suggested apply to smtp is because in the first line of the code you kindly supplied it sez

 

if (EMAIL_TRANSPORT == 'smtp').......

 

I'm just checking that the code is sendmail stuff or smtp for sure.

 

you say you are only using sendmail, so I hope its ok.

 

Thank you and I'll give it a go for real after I've unloaded the smtp contrib that i was playing with just to see if it would work, which it doesn't.

 

Sorry if i've not been clear about this, and again thank you for putting up with my newbieness.

 

regards

Ru

 

ps i've just spotted the "else" bit at the bottom, now that is probably the sendmail bit of the code (ok I'm guessing here)?

Posted

Ok I'm back,

 

I have now

 

1/ set up to send sendmail, LF, no html, no dns. send emails = true

 

2/ changed the email.php file back to the original so smtp auth contrib eliminated, with code additions as per instructions .....

 

3/ logged in and made order as customer (new email, not admin).

 

4/ shop gets order, but customer gets nothing (yet)

 

5/ shop gets back this as well as confirmation of order

 

Delivery-date: Fri, 22 Feb 2008 17:56:27 +0000

Received: from mailnull by xxxx.xxxxxx.co.uk with local (Exim 4.68)

id 1xxxx.xxxxxx

for xxxx.xxxxxx.co.uk; Fri, 22 Feb 2008 17:56:26 +0000

X-Failed-Recipients: [email protected]

Auto-Submitted: auto-replied

From: Mail Delivery System <[email protected]>

To: [email protected]

Subject: Mail delivery failed: returning message to sender

Message-Id: <[email protected]>

Date: Fri, 22 Feb 2008 17:56:26 +0000

X-Antivirus: AVG for E-mail 7.5.516 [269.20.9/1292]

Mime-Version: 1.0

Content-Type: text/plain

 

This message was created automatically by mail delivery software.

 

A message that you sent could not be delivered to one or more of its

recipients. This is a permanent error. The following address(es) failed:

 

xxxx.xxxxxx.co.uk

(generated from xxxx.xxxxxx.co.uk)

Mail sent by user nobody being discarded due to sender restrictions in WHM->Tweak Settings

 

Any help? thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...