Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unrouteable mail domain / SMTP problems - SOLUTION


sezcor

Recommended Posts

I was pulling my hair out with the unrouteable mail domain error (see below).

 

********************************************************

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:

 

[email protected]

unrouteable mail domain "somehost.com"

********************************************************

 

I sifted through all the posts, and could not find a solution. In the end, after 2 long nights, here is how I finally got around the error:

 

1. Download and incorporate the following contribution:

 

http://www.oscommerce.com/community/contributions,901

 

2. Make sure you incorporate the changes to both email.php files (one is in /catalog/includes/classes, the other is in /catalog/admin/includes/classes)

 

3. Make sure you put the "class.smtp.inc" in both directories

 

Some of you may have already tried this, and are saying it doesn't work, or your SMTP server doesn't require authentication. But the problem isn't authentication if you get the "unrouteable mail domain" error, it is the fact that you are trying to send an e-mail to the outside world (any e-mail address that isn't in your domain) from "nobody". Hence, make sure you fill in BOTH the From fields, as well as the other necessary fields, and I assure you this will fix the problem.

 

I had overlooked the fact that there were 2 from fields, and after reading through a hundred or so posts with this problem, I guess others had overlooked this also.

 

Good luck - I am going to get some sleep.

Link to comment
Share on other sites

Thanks, Kirk - I've been searching for the same solution - hope this works. !

 

quick question: do you REPLACE the SMTP code in email.php or do you ADD the code in this contrib to what is already there?

 

thanks - keeping my fingers crossed... :unsure:

Link to comment
Share on other sites

Hi Mike,

 

Very good question - you actually replace the first part of the code (ie. up to but not including the "else" statement. The code still works if you don't replace the first part of the code, but it will try and send 2 e-mails out (one which as we know will have the unrouteable domain problem from "nobody"). The code beneath the else statement is for those using sendmail instead of smtp.

 

Let me know how you go, I am curious to see if others have had success.

 

Good luck.

 

Kirk

Link to comment
Share on other sites

  • 2 weeks later...

This worked for me as well, but I believe that contribution has a problem. While I am now able to send emails using SMTP Authentication, HTML emails are being generated incorrectly.

 

When you send via HTML, it sends the message to the SMTP server in both HTML format (text/html) and TEXT format (text/plain) as a multipart message (multipart/alternative).

 

Because the author of that script is only sending the TO and FROM into the header and not including the multipart/alternative settings, email software that receives it probably won't be able to decode it (Outlook can't). Here's an example of what SHOULD be in the header of a multipart email:

 

Mime-Version: 1.0

Content-Type: multipart/alternative; boundary="=_3873873873873"

 

Then each part in the body is divided by the boundry (plus a leading '--').

 

When I read an email sent using osCommerce and that SMTP contribution, it has the content info in the body but not in the header so Outlook doesn't realize its multipart and shows everything as text (very ugly looking)... an example email as read in Outlook (the first is the text part, the second is the html part):

 

--=_3873873873873

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

 

Dear Chris

 

This automated email is to confirm you are now a registered user ...etc etc etc...

 

--=_3873873873873

Content-Type: text/html; charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable

 

Dear Chris<br><br> This automated email is to confirm you are now a registered user ...<b>etc etc etc...</b> <br>

--=_3873873873873

 

Unfortunately, I'm not a PHP expert so I don't know how to fix this scripting problem. Anyone else notice this same issue?? If so, how do you fix it?

 

That SMTP contribution was written by chen binghua, however I can't find anyway to look this person up, and his script has no contact data.

 

Thanks in advance!

Chris

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

1. Download and incorporate the following contribution:

 

http://www.oscommerce.com/community/contributions,901

 

I installed this contrib, but I can't get it to work. After installing it and configuring it as per Ray Knapp's instructions everything seems OK except that I cannot send mail. No error message and no sign that the mail did not get delivered except that it's never received by the addressee. Also, today I discoverred that during the checkout process, in the last stage, confirmation, when the customer presses the "Confirmation" button they are sent to a blank page. I checked the error log and found this entry that coresponds...

 

PHP Fatal error: Cannot redeclare class smtp in catalog/includes/classes/class.smtp.inc on line 12

I tried removing line 12 in class.smtp.inc but then email.php complains that class smtp is not defined.

 

Has anyone had this problem or know how to fix it? I tried to locate an address for the Author or Ray Knapp but had no luck there.

 

Thanks,

CatDadRick

Link to comment
Share on other sites

  • 1 month later...

The readme says that you can't use the extra order emails with this contrib. Is that still the case? Doesn't anyone know of a different contrib that fixes this problem but still allows you to use the extra order emails?

Link to comment
Share on other sites

Thanks for the reply. I had previously found that thread through searching. The problem is that I don't have an Admin section to my cpanel so I can't figure out if I have a limit or not.

 

In addition, I just set up this installation of OSCommerce and have only two users which are test users. I've only sent out a few emails and this problem has been apparent since the beginning. So I don't think the email limit is the problem. But I'm willing to check anything. Any idea on where else I might check to see if there is a limit or to check the "Web Host Manager" setting?

Link to comment
Share on other sites

  • 3 months later...

Seems I have also been a victim to our Host removing the Nobody option

so I had to install the SMTP Contrib as well..

 

A couple of things I had a problem with and it seems other people have

also had it as it is mentioned here and in other threads..

 

It is a bit of a pain not being able to get the extra order emails but you can

do somthing about this.

 

in catalog/includes/classes/email.php

 

find the line that says:

$send_params['recipients'] = array "$to_addr");

 

Simply add yourself another address here so you get a copy of the mail.

$send_params['recipients'] = array "$to_addr","your extra email address");

 

This will work fine but you will also get a copy of the signup email which is not so bad I guess..

 

Don't wory about the admin email.php otherwise you will get order update emails as well.

 

 

 

The other problem I found after installing and it is mentioned elsewhere in the forum is that once the contrib is installed then it simpl sends blank emails.

I found this was because I copied and pasted the code from the readme and if you check the follwing line:

 

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

 

 

You will notice that there is not a line feed at the end of the "//The body of the email" so if you copied and pasted as I did the $send_params line is actually moved up one line which of coarse is commented out, you may need to scroll accross as mine was right of the page and I did not see it either at first..

 

Trivial stuff!!

 

 

JPL

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

Hi all,

 

The problem I have encountered is that my host (a free hosting company) does not permit smtp on free accounts.

 

Can I assume correctly that this contribution would allow me to send confirmation emails out via another smtp server thereby bypassing my own hosting company?

 

Or is my newbieness showing?

 

I have installed the contribution, have included the smtp.inc in both locations, have edited email.php in both locations taking care to insert call necessary line breaks.

 

Can someone review my work below and see if I have covered everthing correctly? I've substituted my own domain name (www.etc.com) with MYDOMAIN.COM, I would be interested to know if I have the syntax correct here too, especially in the helo field, which I am unfamilar with.

 

Should something be included in the "from" sections also?

 

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

//I have replaced the 2 lines above with this section

// begin smtp authentication
       include(DIR_WS_INCLUDES . '/classes/class.smtp.inc');
// The smtp server host/ip
       $params['host'] = 'smtp.MYDOMAIN.COM';
// The smtp server port
$params['port'] = 25;
// What to use when sending the helo command. Typically, your domain/hostname
       $params['helo'] = 'MYDOMAIN.COM';
// Whether to use basic authentication or not
$params['auth'] = TRUE;
// Username for authentication
$params['user'] = '[my userid for my email service]';
// Password for authentication
$params['pass'] = '[my email service password]';
// The recipients (can be multiple)
$send_params['recipients']	= array("$to_addr");
$send_params['headers']  = array("From: $from", "To: $to_addr", "Subject: $subject");
// This is used as in the MAIL FROM: cmd
// It should end up as the Return-Path: header
$send_params['from']  = '';
// The body of the email
$send_params['body']  = "$this->output";
       is_object($smtp = smtp::connect($params)) AND $smtp->send($send_params);
// end smtp authentication

//I have replaced the 2 lines above with this section

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

 

Also my admin email options are set to:

 

E-Mail Options

 

E-Mail Transport Method smtp

E-Mail Linefeeds CRLF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

 

Regards

Michael

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

This is probably very simple, but so far I have not been able to spot the problem. I added the SMTP contrib, and now I get the following:

 

Warning: Cannot modify header information - headers already sent by (output started at d:\bin\apachegroup\apache\htdocs\catalog\includes\classes\class.smtp.inc:361) in d:\bin\apachegroup\apache\htdocs\catalog\includes\functions\general.php on line 29

 

I know that the normal reasons for this error have to do with prints or extra lines in your include files, but I have checked all of that and have not found the problem. I used the class.smtp.inc file directly from this contribution.

 

I am picking up a project that someone else had started, worked on periodically and abandoned, so I am not completely certain that all of the files in the original distribution are in their virgin state.

 

Thank you for any input you can give me on this problem.

Rex

Link to comment
Share on other sites

  • 1 year later...
I was pulling my hair out with the unrouteable mail domain error (see below).

 

********************************************************

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:

 

[email protected]

unrouteable mail domain "somehost.com"

********************************************************

 

I sifted through all the posts, and could not find a solution. In the end, after 2 long nights, here is how I finally got around the error:

 

1. Download and incorporate the following contribution:

 

http://www.oscommerce.com/community/contributions,901

 

2. Make sure you incorporate the changes to both email.php files (one is in /catalog/includes/classes, the other is in /catalog/admin/includes/classes)

 

3. Make sure you put the "class.smtp.inc" in both directories

 

Some of you may have already tried this, and are saying it doesn't work, or your SMTP server doesn't require authentication. But the problem isn't authentication if you get the "unrouteable mail domain" error, it is the fact that you are trying to send an e-mail to the outside world (any e-mail address that isn't in your domain) from "nobody". Hence, make sure you fill in BOTH the From fields, as well as the other necessary fields, and I assure you this will fix the problem.

 

I had overlooked the fact that there were 2 from fields, and after reading through a hundred or so posts with this problem, I guess others had overlooked this also.

 

Good luck - I am going to get some sleep.

 

I tried this and now when I set SMTP I am getting errors in the shopping cart when it tries to send mail.

 

Warning: send(Mail.php): failed to open stream: No such file or directory in /home/username/public_html/includes/classes/email.php on line 501

 

Warning: send(): Failed opening 'Mail.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/includes/classes/email.php on line 501

 

Fatal error: Undefined class name 'mail' in /home/username/public_html/includes/classes/email.php on line 514

 

 

I use SMTP v1.2 and the update of the email.php. Any ideas?

Slingshot

Sometimes Known As CJ

Link to comment
Share on other sites

I tried this and now when I set SMTP I am getting errors in the shopping cart when it tries to send mail.

 

Warning: send(Mail.php): failed to open stream: No such file or directory in /home/username/public_html/includes/classes/email.php on line 501

 

Warning: send(): Failed opening 'Mail.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/includes/classes/email.php on line 501

 

Fatal error: Undefined class name 'mail' in /home/username/public_html/includes/classes/email.php on line 514

I use SMTP v1.2 and the update of the email.php. Any ideas?

 

Additionally, I have looked through the files and I do not see a mail.php file. I did not have this issue with the previous email.php files.

Slingshot

Sometimes Known As CJ

Link to comment
Share on other sites

File names are case sensitive. There is a mail.php file, but no Mail.php file.

 

Vger

 

 

OK, I am game....where is the mail.php file? I have looked through all the folders and did not see it, also, the SMTP v1.2 or the mail2 contribution has it has Mail.php.

Slingshot

Sometimes Known As CJ

Link to comment
Share on other sites

  • 1 year later...

Hi

 

I am hoping that despite the age of this thread, someone will still be able to help me. I have installed the smtp contribution and have the same error as someone else posted above: emails are now being sent (finally!) but they look awful. I have fancier invoice and packingslip installed and it seems that I need to do something extra to get these two working together. At the moment the email arrives with this :

 

 

--=_51e8625b26a0b75a7ad784242a706a74

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

 

Equestrian Sport Products

 

------------------------------------------------------

 

Order Number: 86

 

 

rather than my neat html invoice (which works on all my other sites/other servers, where I do not have a sendmail problem).

 

If anyone has any idead, I would be really grateful for the help.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...