Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SMTP Contribution - www.oscommerce.com/community/contributions,901


suhy

Recommended Posts

First things first...

 

The email linefeed character parameter must be set to CRLF when using the SMTP protocol.

 

I know all about pretending to be a customer...

 

I don't know why the first 2 imports of the SQL patch failed; 6 is the correct number of SQL statements. If it worked (and I think it did), look at admin -> configuration -> email options page and you will have 6 new configuration parameters that look like:

 

SMTP Server Host Address smtp.mailserver.net

SMTP Server EHLO / HELO Name mailserver.net

SMTP Server Port Number 25

SMTP Authentication Required false

SMTP Authentication Username

SMTP Authentication Password

 

You will need to use change the "SMTP Server Host Address" to specify your SMTP server name. Also change the EHLO /HELO parameter and specify your website domain name (e.g., www.mydomain.com). Since you were getting some emails through, the SMTP port number should be correct and you will not need to enable authentication (i.e., leave SMTP Authentication Required set to false). You do not need to enter the username & password until you enable authentication.

 

Follow the directions in the readme and install the rest of the contribution (if you haven't already). You should be able to test the email by using the "Contact Us" page. If this doesn't work, following the readme directions and enable the debug capability in class.smtp.php file. Send me the output via PM and I'll look at it and see whats wrong.

 

I suspect the problem is the email linefeed configuration setting.

 

Ben

Link to comment
Share on other sites

  • Replies 339
  • Created
  • Last Reply
First things first...

 

The email linefeed character parameter must be set to CRLF when using the SMTP protocol.

 

I know all about pretending to be a customer...

 

I don't know why the first 2 imports of the SQL patch failed; 6 is the correct number of SQL statements. If it worked (and I think it did), look at admin -> configuration -> email options page and you will have 6 new configuration parameters that look like:

 

SMTP Server Host Address smtp.mailserver.net

SMTP Server EHLO / HELO Name mailserver.net

SMTP Server Port Number 25

SMTP Authentication Required false

SMTP Authentication Username

SMTP Authentication Password

 

You will need to use change the "SMTP Server Host Address" to specify your SMTP server name. Also change the EHLO /HELO parameter and specify your website domain name (e.g., www.mydomain.com). Since you were getting some emails through, the SMTP port number should be correct and you will not need to enable authentication (i.e., leave SMTP Authentication Required set to false). You do not need to enter the username & password until you enable authentication.

 

Follow the directions in the readme and install the rest of the contribution (if you haven't already). You should be able to test the email by using the "Contact Us" page. If this doesn't work, following the readme directions and enable the debug capability in class.smtp.php file. Send me the output via PM and I'll look at it and see whats wrong.

 

I suspect the problem is the email linefeed configuration setting.

 

Ben

 

Hi Ben ... no output for me to PM you.

 

6 New Configuration Parameters

You were correct. There are now 6 new config. parameters and I have followed your instructions in changing them.

(SMTP Server Host Adress; SMTP Server EHLO / HELO Name)

 

Readme.txt

I have followed the instructions there and copied the files provided in the contribution to their respective folders. (uploaded)

 

Email Options

set email transport = smtp and Linefeed = CRLF

 

Tested

using

1) Contact Us

2) send email (from admin > tools) to 'customer'

3) tried buying an item

 

Result

Same as original problem : store owner gets email, 'customer' gets none. (Tried both 'customer' emails with different domains )

 

Debug

As per instructions, changed in /catalog/includes/classes/class.smtp.php, the line

$this->debug = TRUE;

 

Ran all the 3 email tests above ... same result (no emails to 'customers', only store owner receives).!!

 

The "Contact Us" test in each case resulted in "Your enquiry has been successfully sent to the Store Owner."

I tried in 2 browsers (Firefox, Avant) just in case. But same result.

 

Er... what do you think is happening??

(p/s I also tried all the above test, incl the Debug ... with linefeed=LF ... just in case.)

 

Thanks Ben!

 

Helena

 

Addn Notes - One final test (with debug still on)

Just to be sure, I set SMTP Authentication Required = true (and entered relevant email & email-password).

Then I did all of the above 3 tests.

THIS TIME CUSTOMER (& store owner got all emails ) -- BIG GRIN.

However .. (not that I am worried anymore) .. the debug being set to true didn't dump any out put at all!!!

 

Thank you very much for your time Ben.

I have set out all of the above just in case it will one day be of some help to someone else.

Link to comment
Share on other sites

Addn Notes - One final test (with debug still on)

Just to be sure, I set SMTP Authentication Required = true (and entered relevant email & email-password).

Then I did all of the above 3 tests.

THIS TIME CUSTOMER (& store owner got all emails ) -- BIG GRIN.

However .. (not that I am worried anymore) .. the debug being set to true didn't dump any out put at all!!!

 

Thank you very much for your time Ben.

I have set out all of the above just in case it will one day be of some help to someone else.

Make sure you disable the debug in class.smtp.php; don't leave it set to true.

 

I don't know why the debug output didn't show up in the browser window. I can't find any PHP configuration parameters that would disable the var_dump() output.

 

It is interesting that your SMTP server allowed mail to be sent to the local domain, but not outside of the local domain until you established an Authenticated connection with it.

 

Live and Learn...

Link to comment
Share on other sites

Make sure you disable the debug in class.smtp.php; don't leave it set to true.

 

I don't know why the debug output didn't show up in the browser window. I can't find any PHP configuration parameters that would disable the var_dump() output.

 

It is interesting that your SMTP server allowed mail to be sent to the local domain, but not outside of the local domain until you established an Authenticated connection with it.

 

Live and Learn...

 

Haha Ben ... I don't know about me having "lived & learnt" ... just glad I survived!!

Yes, thanks for reminder about disabling debug. Did that already - didn't want it to work all of a sudden, down the track, unbeknowsnt to me :)

 

Thanks again. Very much.

 

Helena

Link to comment
Share on other sites

  • 3 weeks later...
I added this to my site and slowed down the order procssing to a halt. When I check send emails false it speeds back up.

What type a server are you hosted on? Linux or Windows? Do you know what type of email server you are connected to?

 

Is a email message actually sent / received? On the surface, it sounds like an email configuration problem triggering retry logic.

 

If you don't mind, turn on the debug option and send me the output via PM. You'll find the directions in the Readme file on how to turn on the debug and how to test it.

 

Ben

Link to comment
Share on other sites

What type a server are you hosted on? Linux or Windows? Do you know what type of email server you are connected to?

 

Is a email message actually sent / received? On the surface, it sounds like an email configuration problem triggering retry logic.

 

If you don't mind, turn on the debug option and send me the output via PM. You'll find the directions in the Readme file on how to turn on the debug and how to test it.

 

Ben

 

What type a server are you hosted on? Linux

Do you know what type of email server you are connected to? Ill Ask my Hosting company

 

Is a email message actually sent / received? Yes, but on check out, it never goes to the completion screen, but payment and emails are being sent.

 

If you don't mind, turn on the debug option and send me the output via PM. Its on, but no output

 

When I turn send off email, my contact us page works great and fast, when I turn send email on, it slows down the contact us page. Both settings still work, but when its off, my new orders and orders updates emails do not work.

Link to comment
Share on other sites

What type a server are you hosted on? Linux

Do you know what type of email server you are connected to? Ill Ask my Hosting company

 

Is a email message actually sent / received? Yes, but on check out, it never goes to the completion screen, but payment and emails are being sent.

 

If you don't mind, turn on the debug option and send me the output via PM. Its on, but no output

 

When I turn send off email, my contact us page works great and fast, when I turn send email on, it slows down the contact us page. Both settings still work, but when its off, my new orders and orders updates emails do not work.

 

Your the second person who does not see debug output....hmmm

 

How is your email configured? Please post the admin -> configuration -> e-mail options parameters (leave out the username & password values).

Link to comment
Share on other sites

Your the second person who does not see debug output....hmmm

 

How is your email configured? Please post the admin -> configuration -> e-mail options parameters (leave out the username & password values).

 

=E-Mail Transport Method smtp

E-Mail Linefeeds CRLF

Use MIME HTML When Sending Emails true

Verify E-Mail Addresses Through DNS false

Send E-Mails true

SMTP Server Host Address mail.mystore.com

SMTP Server EHLO / HELO Name www.mystore.com

SMTP Server Port Number 26 (told to us this by hosting company)

SMTP Authentication Required true

SMTP Authentication Username: [email protected]

SMTP Authentication Password password

Link to comment
Share on other sites

=E-Mail Transport Method smtp

E-Mail Linefeeds CRLF

Use MIME HTML When Sending Emails true

Verify E-Mail Addresses Through DNS false

Send E-Mails true

SMTP Server Host Address mail.mystore.com

SMTP Server EHLO / HELO Name www.mystore.com

SMTP Server Port Number 26 (told to us this by hosting company)

SMTP Authentication Required true

SMTP Authentication Username: [email protected]

SMTP Authentication Password password

So far, so good...

 

Do you have the following parameters defined under admin -> configuration -> my store ?

 

Store Owner

E-Mail Address

E-Mail From

Send extra order emails to

 

The extra order emails parameter is optional, but the others need to be defined correctly.

Link to comment
Share on other sites

Ok,

 

Im not sure how I got this working, but I suppose if anyone puts their mind to something, nothing is impossible....

 

Anyhow, Ill post here what I did in hopes that this can help someone else...

 

I was surfing around my hosting company's (hostmonster - reference only for some other person whos having the same issue) control panel under the email options and saw email filtering. So I decied to play with that and test a spam filter for something unreleated.

 

This is the output I received...

 

Return-path copied from sender

Sender = [email protected]

Recipient = [email protected]

Testing Exim filter file "/etc/vfilters/mydomain.com"

 

 

I noticed a new mail hostserver name so I decied to give it a shot since nothing else was working...

 

And BAM works perfect now.

 

I talked to my hosting company everyday and finally on the 6th day, a customer no service person / helpless desk said they updated an Apache mail server. (downgrade if you ask me)

 

Im sure this is not the ultimate fix, but at least I know where to go. So if this is giving you trouble, ask you hosting company alternative mail server addresss.

 

Hope this helps someone.

Link to comment
Share on other sites

Hello,

 

I can not import smtp_sql.sql to mysql db.

I see error:

 

"INSERT INTO configuration( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added )

VALUES (

 

'SMTP Server Host Address', 'EMAIL_SMTP_HOST_SERVER', 'smtp.mailserver.net', 'The fully qualified host name of the SMTP server.', '12', '10', NULL , now( )

);

 

 

 

MySQL return :

 

#1146 - Table 'tekstylia.configuration' doesn't exist :"

 

 

 

 

My db is emty (without any tables). Should i add tables manually? Did any error ocure during instalation oscommerce shop?

Link to comment
Share on other sites

Hello,

 

I can not import smtp_sql.sql to mysql db.

I see error:

 

"INSERT INTO configuration( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added )

VALUES (

 

'SMTP Server Host Address', 'EMAIL_SMTP_HOST_SERVER', 'smtp.mailserver.net', 'The fully qualified host name of the SMTP server.', '12', '10', NULL , now( )

);

MySQL return :

 

#1146 - Table 'tekstylia.configuration' doesn't exist :"

My db is emty (without any tables). Should i add tables manually? Did any error ocure during instalation oscommerce shop?

 

Your database should not be empty. Sometime prior to installing this database patch, your database was completely deleted or as you suggest, your original installation of oscommerce failed to create a database (or created a database by another name). Are you sure the database name "tekstylia" is the same name you used during the initial installation of oscommerce?

 

Ben

Link to comment
Share on other sites

Ben,

 

I've installed your contribution and I have an interesting dilemma that I haven't seen covered elsewhere -- maybe you can help. My host requires SMTP authentication for emails going outside of its own domain (i.e. to customers), but if you use authentication for emailing to itself (i.e. contact us or order confirmations), it does not send the email. So, I need some sort of check to see if the receiving domain is the same as the store host domain and then use that to determine whether to use authentication or not. I suspect it's a one or two line fix, but you would probably know where to look better than I. If it matters, I'm on a windows hosted server (tho I suspect this isn't the problem or part of any solution).

 

Thanks in advance for your help and thanks for your great contribution.

 

Marv

Link to comment
Share on other sites

Ben,

 

I've installed your contribution and I have an interesting dilemma that I haven't seen covered elsewhere -- maybe you can help. My host requires SMTP authentication for emails going outside of its own domain (i.e. to customers), but if you use authentication for emailing to itself (i.e. contact us or order confirmations), it does not send the email. So, I need some sort of check to see if the receiving domain is the same as the store host domain and then use that to determine whether to use authentication or not. I suspect it's a one or two line fix, but you would probably know where to look better than I. If it matters, I'm on a windows hosted server (tho I suspect this isn't the problem or part of any solution).

 

Thanks in advance for your help and thanks for your great contribution.

 

Marv

 

I've never heard of an email server being configured the way you described it and it doesn't make any sense. Have you 1) confirmed with your web host that what you described is correct? and 2) turned on the SMTP debug capability to see how the server handles a locally addressed email?

 

Are you sure that the following parameters are set correctly in admin -> configuration -> my store ?

 

Store Owner

E-Mail Address

E-Mail From

 

Emails sent to the store are addressed to the "Store Owner" <E-Mail Address>.

 

We can invent a patch for what you may need in email.php. It should be fairly easy, but it just doesn't sound right...

 

Ben

Link to comment
Share on other sites

I've never heard of an email server being configured the way you described it and it doesn't make any sense. Have you 1) confirmed with your web host that what you described is correct? and 2) turned on the SMTP debug capability to see how the server handles a locally addressed email?

 

Are you sure that the following parameters are set correctly in admin -> configuration -> my store ?

 

Store Owner

E-Mail Address

E-Mail From

 

Emails sent to the store are addressed to the "Store Owner" <E-Mail Address>.

 

We can invent a patch for what you may need in email.php. It should be fairly easy, but it just doesn't sound right...

 

Ben

 

 

Ben,

 

I agree with you that this sounds like an odd situation. The way I originally figured out this was the problem was by asking my host why it wasn't working for internal emails. (I searched the forums here, seeing many people with a similar problem, but no responses on how to fix it.) My host had previously told me I needed authentication to get the customer emails working, which then invalidated the emails to the admin. Once I got their answer that to send to the same domain as the admin needed to have authentication off, I tested that and voila, the contact us worked (and the client emails did not).

 

I tried using the debug function (on a contact us) and it did not dump anything to the screen when I had the authentication on. It just ran through as if the email had sent (when it did not) with no errors. It did a screen dump with the authentication turned off and it reported everything as ok.

 

I re-checked the info under My Store and all seems correct.

 

My tests of the store seem to confirm my host's contention. Maybe the fact it is a Windows server has something to do with it? I suspect some of the anti-spamming measures my host has taken may have something to do with this as well (they've had a lot of problems with spam attacks on their SMTP servers over the last year). In any case, if you could help with a patch, I would appreciate it.

 

Thanks.

 

Marv

Link to comment
Share on other sites

Thanks Ben for answer,

 

Now everything works great. The contribution solved my problem with SMTP.

Reason of my problem:

I have 2 hostings and i have been trying to install the contribution on hosting without oscommerce.

 

 

I installed that contribution on os commerce data base and everything works great. But another problem occured:

 

CONTACT WITH US form is out of order. Customer can send email via CONTACT WITH US form but i do not receive that email.

 

Any suggestion how to solve new problem?

Link to comment
Share on other sites

Ben,

 

I agree with you that this sounds like an odd situation. The way I originally figured out this was the problem was by asking my host why it wasn't working for internal emails. (I searched the forums here, seeing many people with a similar problem, but no responses on how to fix it.) My host had previously told me I needed authentication to get the customer emails working, which then invalidated the emails to the admin. Once I got their answer that to send to the same domain as the admin needed to have authentication off, I tested that and voila, the contact us worked (and the client emails did not).

 

I tried using the debug function (on a contact us) and it did not dump anything to the screen when I had the authentication on. It just ran through as if the email had sent (when it did not) with no errors. It did a screen dump with the authentication turned off and it reported everything as ok.

 

I re-checked the info under My Store and all seems correct.

 

My tests of the store seem to confirm my host's contention. Maybe the fact it is a Windows server has something to do with it? I suspect some of the anti-spamming measures my host has taken may have something to do with this as well (they've had a lot of problems with spam attacks on their SMTP servers over the last year). In any case, if you could help with a patch, I would appreciate it.

 

Thanks.

 

Marv

OK, I had to ask. I don't think it has anything to do with it being a Windows server. You are probably correct that it has more to do with anti-spam measures than anything else.

 

Give me a few days, I'll put something together and post it here.

 

Ben

Link to comment
Share on other sites

Thanks Ben for answer,

 

Now everything works great. The contribution solved my problem with SMTP.

Reason of my problem:

I have 2 hostings and i have been trying to install the contribution on hosting without oscommerce.

I installed that contribution on os commerce data base and everything works great. But another problem occured:

 

CONTACT WITH US form is out of order. Customer can send email via CONTACT WITH US form but i do not receive that email.

 

Any suggestion how to solve new problem?

When you say it works, what do you mean? Are you receiving any emails sent by the website? Order emails? Emails sent from the Admin side to a customer?

 

You probably have a configuration problem. Please post your email configuration parameters from:

 

admin -> configuration -> My Store (Store Owner, email address and email from address parameters)

admin -> configuration -> E-mail Options (all of them, except for the password)

 

Ben

Link to comment
Share on other sites

OK, I had to ask. I don't think it has anything to do with it being a Windows server. You are probably correct that it has more to do with anti-spam measures than anything else.

 

Give me a few days, I'll put something together and post it here.

 

Ben

Marv,

 

Here is a quick hack for your unique problem. In the file includes/class/email.php near line 561 you will find:

 

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

Just before this code, add the following:

 

		//Force password authentication off when email is destine for the store owner
	if ($recipients[0] == STORE_OWNER_EMAIL_ADDRESS) {
	   $params['auth'] = "false";
	}

You will need to make the same change to the admin/includes/class/email.php file.

 

The above code will force SMTP password authentication off for any message where the first recipient is the store owner email address. This should solve your problem; however, this is not quite what you asked for. You asked for a patch to disable authentication for any message destine for the local domain, not specifically addressed to the store owner. If this doesn't work for you, let me know and I can add some logic to slice and dice the email addresses and compare just the domain portion.

 

Ben

Link to comment
Share on other sites

Marv,

 

Here is a quick hack for your unique problem. In the file includes/class/email.php near line 561 you will find:

 

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

Just before this code, add the following:

 

		//Force password authentication off when email is destine for the store owner
	if ($recipients[0] == STORE_OWNER_EMAIL_ADDRESS) {
	   $params['auth'] = "false";
	}

You will need to make the same change to the admin/includes/class/email.php file.

 

The above code will force SMTP password authentication off for any message where the first recipient is the store owner email address. This should solve your problem; however, this is not quite what you asked for. You asked for a patch to disable authentication for any message destine for the local domain, not specifically addressed to the store owner. If this doesn't work for you, let me know and I can add some logic to slice and dice the email addresses and compare just the domain portion.

 

Ben

 

Ben,

 

I just applied your patch and it seems to work. Thanks a million! If you lived a litte closer than the opposite coast, I'd take you out for a beverage of your choice. (BTW, I used to live in Long Beach before moving back to NJ.)

 

Thanks again!

 

Marv

Link to comment
Share on other sites

Hello!

 

I've installed your contribution and it works ok, but i've noticed one thing:

 

when I receive emails (with orders) through The Bat "received date" and "created date" are the same

and in "message dispatcher" field "time" is empty. I suppose that email creation time don't pass.... probably. :blush:

 

When I use another smtp-contribution I didn't have problem like this.

 

Thanks in advance for help!

Link to comment
Share on other sites

Hello!

 

I've installed your contribution and it works ok, but i've noticed one thing:

 

when I receive emails (with orders) through The Bat "received date" and "created date" are the same

and in "message dispatcher" field "time" is empty. I suppose that email creation time don't pass.... probably. :blush:

 

When I use another smtp-contribution I didn't have problem like this.

 

Thanks in advance for help!

Irina,

 

Thanks for pointing out this problem to me. I've just posted an update to the contribution which adds a MIME date / time header to the SMTP based email message. I'm not sure how this will effect your email client, but at least one of the date fields should represent the origination date/time of the message.

 

Ben

Link to comment
Share on other sites

Irina,

 

Thanks for pointing out this problem to me. I've just posted an update to the contribution which adds a MIME date / time header to the SMTP based email message. I'm not sure how this will effect your email client, but at least one of the date fields should represent the origination date/time of the message.

 

Ben

 

I've updated my files and couldn't receive any emails after it.

 

But then I've returned lines to email.php:

$this->output = preg_replace(array("/\r\n/","/\n/", "/\r/"), "xxCRLFxx", $this->output);
$this->output = preg_replace("/xxCRLFxx/", "\r\n", $this->output);

 

And now everything works and I don't have any problem with date/time. :rolleyes:

 

Thanks!

Link to comment
Share on other sites

I've updated my files and couldn't receive any emails after it.

 

But then I've returned lines to email.php:

$this->output = preg_replace(array("/\r\n/","/\n/", "/\r/"), "xxCRLFxx", $this->output);
$this->output = preg_replace("/xxCRLFxx/", "\r\n", $this->output);

 

And now everything works and I don't have any problem with date/time. :rolleyes:

 

Thanks!

 

Sounds like your admin -> configuration -> E-mail Options -> E-Mail Linefeed parameter is mis-configured. It should be set to CRLF. I removed that bit of logic because it is unnecessary when the email options are set correctly.

 

Ben

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...