Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


suhy

Recommended Posts

You did not need to edit the class.smtp.php file. All of the configurable parameters can be changed via the admin -> configuration -> email options.

 

I don't think this explains the problem you are seeing, but just for fun, try installing a clean version of the contribution and see what happens.

 

It should work just fine with v2.2 RC.

 

Do you have access to any of the log files from your server? Have you tried to turn on the PHP display errors parameter?

 

Ben

 

That popped in my mind as well and I installed clean set of files from the zip directly to the folders without any changes and the same thing happens. I will turn on the PHP errors parameter and see what it spits out.

Link to comment
Share on other sites

  • Replies 339
  • Created
  • Last Reply
That popped in my mind as well and I installed clean set of files from the zip directly to the folders without any changes and the same thing happens. I will turn on the PHP errors parameter and see what it spits out.

 

Ok I got some errors that should highlight the issue.

 

Warning: require(includes/classes/email.php) [function.require]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\rssi\catalog\includes\application_top.php on line 265

 

Fatal error: require() [function.require]: Failed opening required 'includes/classes/email.php' (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\rssi\catalog\includes\application_top.php on line 265

 

 

line 265 in application_top.php -> require(DIR_WS_CLASSES . 'email.php');

Link to comment
Share on other sites

Ok I got some errors that should highlight the issue.

 

Warning: require(includes/classes/email.php) [function.require]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\rssi\catalog\includes\application_top.php on line 265

 

Fatal error: require() [function.require]: Failed opening required 'includes/classes/email.php' (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\rssi\catalog\includes\application_top.php on line 265

 

 

line 265 in application_top.php -> require(DIR_WS_CLASSES . 'email.php');

 

Ok another weird thing just for fun I put a blank file in the class directory and named it email.php and guess what no Errors, but of course no code in the file.

Link to comment
Share on other sites

Ok another weird thing just for fun I put a blank file in the class directory and named it email.php and guess what no Errors, but of course no code in the file.

OK, Let me see if I understand this correctly...

 

The standard distribution of osCommerce which includes the file includes/classes/email.php does not generate the error.

 

You load the contribution, which over-writes the existing file with a modified file and creates the includes/classes/class.smtp.php file, and the error occurs.

 

Sounds like a file permissions problem. Check the permissions of the email.php and class.smtp.php files. They have to be visible and readable by the web server (apache) daemon.

 

Your running on a Windows based server. I'm not quite sure what you look at or how you fix the file permissions.

 

Ben

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I have installed the latest version of the contribution.

 

I am tesing it with the password reminder feature at login.

 

Emails sent to Hotmail are correctly being sent but those to other non free based accounts are not being received.

 

Any ideas, I have tried everything with no success.

 

Thanks in advance,

 

Rob.

Link to comment
Share on other sites

On a web hosting company's server you can hack in some code to catch the SMTP exchange in the send_data() and get_data() routines in the class.smtp.php file. The SMTP exchange is all text based, so you can use the PHP var_dump routine to print the session to your web browser screen with something like the following:

 

var_dump( get_or_set_data, "<br>");

 

From the output it should be fairly obvious what is mis-configured.

 

Ben

 

Hi Ben, i have same problem as many people has, no errors and no email sent.

Can you help me on building the send_data and get_data functions?

 

Thanks

Link to comment
Share on other sites

Forgot to post the server info:

 

 

register_globals on on

sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i

sendmail_from no value no value

SMTP localhost localhost

smtp_port 25 25

Link to comment
Share on other sites

Hi Ben, i have same problem as many people has, no errors and no email sent.

Can you help me on building the send_data and get_data functions?

 

Thanks

I built-in a debug capability into the contribution.

 

Follow the instructions in the readme file to enable the debug capability and tell me what you see (or send me the output via a PM - don't post it). Occasionally, the debug capability does not produce output (for reasons I do not understand and I would dearly love to figure out).

 

Ben

Link to comment
Share on other sites

Hi,

 

I have installed the latest version of the contribution.

 

I am tesing it with the password reminder feature at login.

 

Emails sent to Hotmail are correctly being sent but those to other non free based accounts are not being received.

 

Any ideas, I have tried everything with no success.

 

Thanks in advance,

 

Rob.

Rob,

 

Have you tried any of the other email capabilities (i.e., Contact Us, Admin -> send email)?

 

How do you have your email parameters defined? Are you using email authentication? What is your email linefeed parameter defined as? Post your admin -> my store -> email options (all except the SMTP username and password).

 

Have you enabled the debug capability?

 

Ben

Link to comment
Share on other sites

  • 4 weeks later...

Hello -

 

For whatever this is worth, I used the original osCommerce email.php files to get this contribution to work. Using the email.php files that came with the contribution did not work, and sadly, there was no breakdown of the changes - ie. This contribution would have been a bugger to have installed manually if my email.php files were already edited in some way. I will run a diff on teh two files later to see what exactly changed.

 

Also, permissions were not an issue -- not only were both files readable by Apache, but both files had identical permissions (644).

 

I have set things up, then, and it seems to be working fine when I use the "send an email" function and send an email only to myself... HOWEVER, we are using Google Apps and the instructions I have seen for setup with Google is to leave the HTML email FALSE... Yikes! Does this mean that if I send out my meticulously crafted HTML newsletters, that all of the customers will receive only plain text?! What would happen if I left HTML TRUE?

 

I have already tried installing a WYSIWYG editor on the mail.php page for the "send an email" function, and I received the emails in plain text (ie. the code I input directly into the WYSIWYG editor's HTML field was sent unparsed...) I wish there was a way to send out test newsletters only to the store owner before sending "for real"!

 

Thanks!

Link to comment
Share on other sites

Does anyone know how to get this working on a local development server or a sever that isn't actually hosting the SMTP?

I'd like to use this live but it would be great to get it working on my dev server first.

Link to comment
Share on other sites

Hello -

 

For whatever this is worth, I used the original osCommerce email.php files to get this contribution to work. Using the email.php files that came with the contribution did not work, and sadly, there was no breakdown of the changes - ie. This contribution would have been a bugger to have installed manually if my email.php files were already edited in some way. I will run a diff on teh two files later to see what exactly changed.

 

Also, permissions were not an issue -- not only were both files readable by Apache, but both files had identical permissions (644).

 

I have set things up, then, and it seems to be working fine when I use the "send an email" function and send an email only to myself... HOWEVER, we are using Google Apps and the instructions I have seen for setup with Google is to leave the HTML email FALSE... Yikes! Does this mean that if I send out my meticulously crafted HTML newsletters, that all of the customers will receive only plain text?! What would happen if I left HTML TRUE?

 

I have already tried installing a WYSIWYG editor on the mail.php page for the "send an email" function, and I received the emails in plain text (ie. the code I input directly into the WYSIWYG editor's HTML field was sent unparsed...) I wish there was a way to send out test newsletters only to the store owner before sending "for real"!

 

Thanks!

Robert,

 

If you replaced the email.php file with the stock osCommerce version, you are not using any of the capabilities provided by this contribution. To the best of my knowledge, none of the higher level contributions (i.e., fancy order conformation emails) modify the email.php file. The email.php file is a protocol level module, now an application level module.

 

Gmail requires the email connection to use the TLS protocol; it will not accept a TCP connection. You can search this topic and find the description of how to specify the use of TLS. I know the contribution works with Gmail, I tested it in the process of figuring out how to configure it for another osCommerce user.

 

This contribution (like the standard osCommerce email code) supports HTML. The standard higher level code (like the order confirmation email) does not produce a nicely formatted email message when you switch to HTML based email (it just sends the text base message in HTML). You need to add one of the other contributions to get something nice looking.

 

If HTML email is enabled, the HTML passed to the email.php methods is sent to the specified recipients. The only thing the email.php class does is properly format an email message with embedded HTML. It does not know are care about the content of the HTML.

 

Ben

Link to comment
Share on other sites

Does anyone know how to get this working on a local development server or a sever that isn't actually hosting the SMTP?

I'd like to use this live but it would be great to get it working on my dev server first.

You configure the email parameters normally. The fact that it is running on a local development system (assuming it has an Internet connection) doesn't matter. Just enter in the SMTP server's address, port number, user name and password. As long as your development system can establish a connection with the server, everything will work just fine. Since the development machine is attempting to establish an outbound SMTP connection (like any other email client), there shouldn't be any firewall configuration issues for you to deal with.

 

Ben

Link to comment
Share on other sites

  • 4 weeks later...

Hi!

 

Well, i'm having troubles as well...

I did all the changes, but when i try to send an email trough the 'Contact Us' form, gives me this error:

 

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:465 in /home/peach/public_html/tienda/catalog/includes/classes/class.smtp.php on line 102

 

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

 

Any idea? i've tried changing every value and using different email accounts that are configured through google apps, and my own gmail mail... but nothing works :(

Link to comment
Share on other sites

Hi!

 

Well, i'm having troubles as well...

I did all the changes, but when i try to send an email trough the 'Contact Us' form, gives me this error:

 

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:465 in /home/peach/public_html/tienda/catalog/includes/classes/class.smtp.php on line 102

 

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

 

Any idea? i've tried changing every value and using different email accounts that are configured through google apps, and my own gmail mail... but nothing works :(

Gmail requires the use of the TLS protocol to connect to the server. To connect to gmail, define the server address and port number as:

 

SMTP server address: tls://smtp.gmail.com

SMTP server port: 465 or 587

 

Enable SMTP authentication and specify your gmail account name and password.

 

Ben

Link to comment
Share on other sites

Gmail requires the use of the TLS protocol to connect to the server. To connect to gmail, define the server address and port number as:

 

SMTP server address: tls://smtp.gmail.com

SMTP server port: 465 or 587

 

Enable SMTP authentication and specify your gmail account name and password.

 

Ben

 

Hi Ben,

 

Thanks for your quick reply.

I did config the SMTP server address including the 'tls://', but the error message (that appears a few seconds after clicking the send button on the contact us form) doesn't say 'tls://'

 

In fact, i've followed all the specifications in the kustomjs's contribution "SMTP Settings For Google Apps OR Gmail", and nothing worked... even changing the 'tls://' by 'ssl://', as well as testing with 465 and 587 ports... The only thing i didn't understand completely was the "SMTP Server EHLO / HELO", but i don't think that's the problem...

 

Here i paste the full data, as i've filled in the panel:

 

E-Mail Transport Method smtp

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

SMTP Server Host Address tls://smtp.gmail.com

SMTP Server EHLO / HELO Name mydomain.com.ve

SMTP Server Port Number 465

SMTP Authentication Required true

SMTP Authentication Username [email protected]

SMTP Authentication Password P@ssw0rd

 

Any idea what else could be the problem?

Thanks a lot!

 

Dan

Link to comment
Share on other sites

You configure the email parameters normally. The fact that it is running on a local development system (assuming it has an Internet connection) doesn't matter. Just enter in the SMTP server's address, port number, user name and password. As long as your development system can establish a connection with the server, everything will work just fine. Since the development machine is attempting to establish an outbound SMTP connection (like any other email client), there shouldn't be any firewall configuration issues for you to deal with.

 

Ben

 

Further on this. I installed the contribution fine, and will be using it on a development system. Wondering what the correct entry is for SMTP Server EHLO / HELO Name. Is it localhost, or the name of the SMTP server to be used?

 

Thanks,

 

Bruce

Link to comment
Share on other sites

Hi Ben,

 

Thanks for your quick reply.

I did config the SMTP server address including the 'tls://', but the error message (that appears a few seconds after clicking the send button on the contact us form) doesn't say 'tls://'

 

In fact, i've followed all the specifications in the kustomjs's contribution "SMTP Settings For Google Apps OR Gmail", and nothing worked... even changing the 'tls://' by 'ssl://', as well as testing with 465 and 587 ports... The only thing i didn't understand completely was the "SMTP Server EHLO / HELO", but i don't think that's the problem...

 

Here i paste the full data, as i've filled in the panel:

 

E-Mail Transport Method smtp

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

SMTP Server Host Address tls://smtp.gmail.com

SMTP Server EHLO / HELO Name mydomain.com.ve

SMTP Server Port Number 465

SMTP Authentication Required true

SMTP Authentication Username [email protected]

SMTP Authentication Password P@ssw0rd

 

Any idea what else could be the problem?

Thanks a lot!

 

Dan

Dan,

 

E-Mail Linefeeds should be set to CRLF.

 

The SMTP Authentication Username / Password should specify the parameters of a gmail account name (i.e., [email protected])

 

Ben

Link to comment
Share on other sites

Further on this. I installed the contribution fine, and will be using it on a development system. Wondering what the correct entry is for SMTP Server EHLO / HELO Name. Is it localhost, or the name of the SMTP server to be used?

 

Thanks,

 

Bruce

Bruce,

 

The EHLO / HELO name is just a character string. Most SMTP servers do not care what the string is, just that it is defined. Your hosting company will tell you if it needs to be defined as a specific value.

 

Typically, EHLO / HELO name is the domain name of the web site or web server. On your development machine, localhost should work.

 

Ben

Link to comment
Share on other sites

Bruce,

 

The EHLO / HELO name is just a character string. Most SMTP servers do not care what the string is, just that it is defined. Your hosting company will tell you if it needs to be defined as a specific value.

 

Typically, EHLO / HELO name is the domain name of the web site or web server. On your development machine, localhost should work.

 

Ben

 

OK I'll give it a go! Thanks, Bruce

Link to comment
Share on other sites

  • 3 weeks later...

alright so this is my first time posting so hello to all.

 

im having difficulty getting my server (linux; ubuntu 8.04) to connect to the gmail smtp server (tls://smtp.gmail.com). i can connect to it via my workstation which uses thunderbird (smtp.gmail.com sans tls:// prefix). i have a feeling its something thats not configured properly, most likely openssl

 

whenever i try to send an email i get the following:

 

Warning: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number in /var/www/montauk/catalog/admin/includes/classes/class.smtp.php on line 102

 

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in /var/www/montauk/catalog/admin/includes/classes/class.smtp.php on line 102

 

Warning: fsockopen() [function.fsockopen]: unable to connect to tls://smtp.gmail.com:587 (Unknown error) in /var/www/montauk/catalog/admin/includes/classes/class.smtp.php on line 102

array(1) { [0]=> string(29) "Failed to connect to server: " } string(52) "

 

SMTP debug enabled in class.smtp.php

 

" array(2) { [0]=> string(29) "Failed to connect to server: " [1]=> string(14) "Not connected!" } string(52) "

 

SMTP debug enabled in class.smtp.php

 

"

Warning: Cannot modify header information - headers already sent by (output started at /var/www/montauk/catalog/admin/includes/classes/class.smtp.php:102) in /var/www/montauk/catalog/admin/includes/functions/general.php on line 22

 

and this is my configuration for email, which is the same as thunderbird except for the prefix.

 

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

SMTP Server Host Address tls://smtp.gmail.com

SMTP Server EHLO / HELO Name projectmontauk.com

SMTP Server Port Number 587

SMTP Authentication Required true

SMTP Authentication Username "user"@projectmontauk

SMTP Authentication Password ************

 

any hints or help would be appreciated.

Link to comment
Share on other sites

im having difficulty getting my server (linux; ubuntu 8.04) to connect to the gmail smtp server (tls://smtp.gmail.com). i can connect to it via my workstation which uses thunderbird (smtp.gmail.com sans tls:// prefix). i have a feeling its something thats not configured properly, most likely openssl

 

you're using the tls:// protocol prefix, which requires openssl to be installed for php. this is probably set up on your workstation at home, but not the server on your host. double check with your host and see if they support openssl. this is something that thay'd have to turn on/enable in the php.ini file.

Link to comment
Share on other sites

alright so this is my first time posting so hello to all.

 

im having difficulty getting my server (linux; ubuntu 8.04) to connect to the gmail smtp server (tls://smtp.gmail.com). i can connect to it via my workstation which uses thunderbird (smtp.gmail.com sans tls:// prefix). i have a feeling its something thats not configured properly, most likely openssl

There is something wrong with the SSL configuration on the web server since the fsockopen call is having problems. I can't help you much there as it is a server configuration problem. The OsCommerce code actually doesn't do anything special to establish a TLS connection with an email server. All of the logic is built into the PHP fsockopen function to establish a TLS connection when the server name is prepended with the protocol.

 

However, once you get the SSL configuration fixed, you will need to specify a gmail account name / password as the SMTP Authentication parameters (i.e., something like [email protected] )

 

Ben

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...