Jump to content
Sign in to follow this  
khairil

phpMailer4osC contribution support

Recommended Posts

A simple contribution to make osCommerce works with smtp mail that requires authentication.

You can find this contribution here

Edited by khairil

Share this post


Link to post
Share on other sites
A simple contribution to make osCommerce works with smtp mail that requires authentication.

You can find this contribution here

 

I installed this and fixed my problem. However now all my emails look wierd. It seems to encode the html wrong? Any ideas and help would be very much appreciated.

 

Regards

Share this post


Link to post
Share on other sites

I have installed phpMailer4osC and works,

the only problem is that email HTML does not arrive with all the attacked words seems that does not go to head when demanded as an example:

 

if this is the phrase sended via email:

 

this is problem

with

oscommerce

 

 

----> to the customer it arrives:

 

this is problem with oscommerce

 

 

 

solution?

Share this post


Link to post
Share on other sites

Yeah, I figured the problem is because this contrib send email in HTML while osC send email in plain text.

 

Resolution:

in includes/classes/email.php and admin/includes/classes/email.php where edited in phpMailer4osC installation,

replace;

$pMail->IsHTML(true);

with;

$pMail->IsHTML(false);

 

i hope this will help, cheers! :thumbsup:

 

I'll update the package in contribs with new one.. thx for the feedback.!

Share this post


Link to post
Share on other sites
Yeah, I figured the problem is because this contrib send email in HTML while osC send email in plain text.

 

Resolution:

in includes/classes/email.php and admin/includes/classes/email.php where edited in phpMailer4osC installation,

replace;

$pMail->IsHTML(true);

with;

$pMail->IsHTML(false);

 

i hope this will help, cheers! :thumbsup:

 

I'll update the package in contribs with new one.. thx for the feedback.!

 

this is my temporary solution if you are not using 'MIME HTML when sending email'. I will fix my contribs to fully support osC email configuration like 'E-mail linefeeds (LF/CRLF)' tomorrow..

 

sorry

Edited by khairil

Share this post


Link to post
Share on other sites

Hi All

 

I have got the phpmailer contrib working fine from the customers view point but I can't get any emails to send from the admin side... i do not know what the problem is, it says that emails have been sent but they haven't... this includes the order notification emails as well.

 

Anybody found this problem and know what I might be doing wrong?

 

thanks

 

Simon

Share this post


Link to post
Share on other sites
Hi All

 

I have got the phpmailer contrib working fine from the customers view point but I can't get any emails to send from the admin side... i do not know what the problem is, it says that emails have been sent but they haven't... this includes the order notification emails as well.

 

Anybody found this problem and know what I might be doing wrong?

 

thanks

 

Simon

 

just copy

includes/classes/email.php

to

admin/includes/classes/email.php

 

it'll work fine..

maybe u misconfigure something in 'admin/includes/classes/email.php'

Share this post


Link to post
Share on other sites
I installed this and fixed my problem. However now all my emails look wierd. It seems to encode the html wrong? Any ideas and help would be very much appreciated.

 

Regards

 

Did you ever find out this problem? I'm having the same issue. The email that is sent is all funky.

 

 

snagPBS.jpg

Share this post


Link to post
Share on other sites

Hey great contrib. I was having serious problems getting emails out until this fixed it. Have you come up witha solution for the funny looking html problem? I have it set to text for now, but I would like to send out MIME Html soon.

Share this post


Link to post
Share on other sites
I have got the phpmailer contrib working fine from the customers view point but I can't get any emails to send from the admin side... i do not know what the problem is, it says that emails have been sent but they haven't... this includes the order notification emails as well.

 

I have the same problem, everything is OK from catalog-side - but from admin-side there seems to be an error in in adressing.

 

This is from the smtp-server:

 

warning: Illegal address syntax from unknown[10.0.1.15] in MAIL command:

 

Any idea why this is happening?

Share this post


Link to post
Share on other sites

Hi, this email thing is driving me nuts! I started having email problems with three osCommerce sites just recently (found out yesterday) and after hours of trying, this contribution seems to be the only solution. My sites are hosted on a Win32 server and I guess it gets changed fairly often as I often feel the sharp end of changes that are made. Due to this I thought I would try this mod instead of submitting a helpdesk ticket to my hosts.

 

After installing it, I found that the emails work for admin and customer...unless it's a hotmail account?! I have tried various tests with my hotmail and isp account (v21.co.uk) and the emails failed every time for the hotmail.

 

I then started to test it with various email accounts for my domain name (I have a catch all account so set up accounts with emails such as customer1@domainname.com, customer2@domainname.com). The newsletter, admin email, order update, customer email, product notification..all work for the non hotmail accounts but fail for the hotmail. For the hotmail account I get an returned email to the store admin address like this:

 

We're sorry. There's a problem with the e-mail address(es) you're trying to send to. Please verify the address(es) and try again. If you continue to have problems, please contact Customer Support at (480) 624-2500.

 

<marcuswilding@hotmail.com>:

Connected to 65.54.245.40 but sender was rejected.

Remote host said: 501 Invalid Address

 

--- Below this line is a copy of the message.

 

Return-Path: <"SRS0=zW1u=46=uploadyourbusiness.com=TESTSITE <admin"@bounce.secureserver.net>

Received: (qmail 14230 invoked by uid 1000); 7 Mar 2006 23:51:29 -0000

Delivered-To: marcus@uploadyourbusiness.com

Received: (qmail 14223 invoked from network); 7 Mar 2006 23:51:29 -0000

Received: from pre-smtp13-02.prod.secureserver.net (HELO pre-smtp13-02.prod.mesa1.secureserver.net) ([64.202.166.17])

(envelope-sender <TESTSITE??admin@uploadyourbusiness.com>)

by smtp03-01.prod.mesa1.secureserver.net (qmail-ldap-1.03) with SMTP

for <marcus@uploadyourbusiness.com>; 7 Mar 2006 23:51:29 -0000

Received: (qmail 9401 invoked from network); 7 Mar 2006 23:51:29 -0000

Received: from unknown (HELO www.uploadyourbusiness.com) ([209.132.213.40])

(envelope-sender <TESTSITE??admin@uploadyourbusiness.com>)

by pre-smtp13-02.prod.mesa1.secureserver.net (qmail-ldap-1.03) with SMTP

for <marcus@uploadyourbusiness.com>; 7 Mar 2006 23:51:28 -0000

Date: Tue, 7 Mar 2006 15:53:04 -0800

Return-Path: TESTSITE <admin@uploadyourbusiness.com>

To: marcus wilding II <marcus@uploadyourbusiness.com>

From: TESTSITE <admin@uploadyourbusiness.com>

Subject: test newsletter

Message-ID: <80d4575cda906a3d8c049a9cb6a2fe48@www.uploadyourbusiness.com>

X-Priority: 3

X-Mailer: PHPMailer [version 1.73]

MIME-Version: 1.0

Content-Transfer-Encoding: 8bit

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

 

When selecting my SMTP settings for email.php I have entered:

 

$pMail->Host = "smtp.secureserver.net";

$pMail->Username = "";

$pMail->Password = "";

$pMail->SMTPAuth = false;

 

Does this mean that smtp.secureserver.net may be blocking hotmail email or something? Any help would be appreciated.

 

Cheers Marcus

 

ps:- Thanks for the contribution khairil

Share this post


Link to post
Share on other sites

:blush: Okay, forget that last message, I was wrong about the ISP email, the account I set up with my v21.co.uk was also failing. I think I see what I'm doing wrong.

 

I have the domain www.uploadyourbusiness.com (test site) hosted at webhost4life and they gave an SMTP address for the mail for this domain 'smtp.secureserver.net'. I guess only domains setup for this address can get mails through it and this is where I am going wrong.

 

As I set up my SMTP with the details from my domain registrar it is letting all email with my domain name pass though, all other email gets blocked.

 

I guess my question is, what SMTP server do I use?

 

Cheers,

Marcus.

 

:blink:

Share this post


Link to post
Share on other sites

Ok, I just asked my hosts 'What SMTP server do I use for php? '

 

They replied 'You do NOT need to use any. All servers are setup to send email in the php.ini. You do not need to make any changes to it. '

 

Does this mean that the PHP.INI is incorrect?

Share this post


Link to post
Share on other sites

Right. Your best bet is to check your php settings and make sure SMTP reads as localhost or 127.0.0.1

You sendmail should be from ie. admin@yourdomain.com

 

As far as the mail is concerned .. I believe you were misinformed by your service provider.

Your email class needs to know your Host .. Username ... and Password, or else anyone could use anyones Host to send mail to anyone. Your Host has to verify that you are who you say you are in order to gain access to the mail server.

 

 

You should also check in both the catalog side and admin side .. the directory includes/classes/email.php

 

Where you see something similar to this: You need to find out from your Host what their SMTP address is. For example I am with bellnet ... one of their most common open channel for smtp is ... smtp10.bellnet

 

$pMail->IsSMTP();

$pMail->Host = "smtp10.bellnet.ca"; // replace with your smtp server // ie mail.yourdomain.com

$pMail->Username = "myregisterednamehere@bellnet.ca"; // replace with your smtp username (if SMTPAuth is true)

$pMail->Password = "mypasswordhere"; // replace with your smtp password (if SMTPAuth is true)

$pMail->SMTPAuth = true; // true/false - turn on/off smtp authentication

 

Hope this gets you on the right track.

Share this post


Link to post
Share on other sites

Thanks for the info insomniac2, do you mean the PHP on web host4lifes server? I ran a quick script on the server of webhost4life which returned the following info for the php settings on the server my sites are running on. Does it look correct?

 

safe_mode Off

sendmail_from me@localhost.com

sendmail_path no value

serialize_precision 100

short_open_tag On

SMTP 209.132.213.40

 

Also, when you say my sendmail settings, do you mean in the stores Admin --> Configuration -->My Store Setting?

 

The confusing thing for me is my domain name is registered with godaddy.com - www.mydomain.com

 

The email account is registered with them - admin@mydomain.com

 

But my site is actually hosted with webhost4life

 

who do I get the SMTP host, username and password from? The company who hosts my site or I have my email with?.....I guesss I should look at moving it all together..

Share this post


Link to post
Share on other sites

OK I assume from what your saying is that you have an email account registered with godaddy.com ... You say it is admin@godaddy.com

 

so if this is true what you would do is ...

 

1. yes check your admin configuration setting ... make sure it is set to use SMTP

 

2. since you are not hosting your own server .. don't worry about php.ini stuff .. it does not apply to you.

 

3. i assume you are using phpMailer4osC - smtp with authentication from your posts here. I am using it and it works great.

 

4. Now there are 2 files you have to set up with this package. Go to

catalog/includes/classes/email.php ... and

catalog/admin/includes/classes/email.php

 

Assuming you installed the mod correctly and as in the instructions

reconfigured the code in class.smtp.php files

 

Now in each email.php file find the section I mentioned in the previous post which looks like this and put your info there. This is where your problem is.

 

$pMail->IsSMTP();

$pMail->Host = "mail@yourdomain.com"; // replace with your smtp server // ie mail.yourdomain.com

$pMail->Username = "admin@mydomain.com"; // replace with your smtp username (if SMTPAuth is true)

$pMail->Password = "mypasswordhere"; // replace with your smtp password (if SMTPAuth is true)

$pMail->SMTPAuth = true; // true/false - turn on/off smtp authentication

 

 

Notice the three variable you have to put you info in:

 

yourdomain.com is the domain name you registered with godaddy.com ... put it where the words yourdomain.com are.

 

mydomain.com is your email account name registered with godaddy.com ... so put your username in where the words mydomain.com are.

 

mypasswordhere is your email account password for your godaddy.com email account .. so put your password in where the words mypasswordhere are.

 

I know it is confusing at first ... but once you get it .. u will see the big picture. And if we knew your real domain name it would be a lot less writing and confusion.

Share this post


Link to post
Share on other sites

oops sorry ... I meant to say for the second variable:

 

mydomain.com is your email account name registered with godaddy.com ... so put your username in where the words admin are ... and the your registered domain name where the words mydomain.com are

Share this post


Link to post
Share on other sites

Thanks for the help insomniac2, that?s almost the setup I had originally when I was getting all emails failing except for ones setup for the domain. My settings are now as below:

 

my domain - www.uploadyourbusiness.com

 

$pMail->Host = "smtpout.secureserver.net";

$pMail->Username = "admin@uploadyourbusiness.com";

$pMail->Password = "*******";

$pMail->SMTPAuth = true;

 

The smtpout.secureserver.net part is what godaddy told me to set to get the account working with Outlook. Putting 'uploadyourbusiness.com' here doesn't allow any email functionality to work.

 

Using the settings shown above, the contact us page works fine. I then setup three test users with the following email accounts:

 

Customer 1 - marcuswilding@hotmail.com

Customer 2 - admin@uploadyourbusiness.com

Customer 3 - mwildin1@v21net.co.uk

 

I ran a few tests and found the following:

  • All three of these customer accounts can request password emails fine.
  • All three accounts can use the notify a friend to send product info
  • The store owner/admin can only send newsletters AND emails to Customer 2, who has the admin@uploadyourbusiness.com email account. The other two Customers get 'Remote host said: 501 unacceptable mail address'
  • When ANY of the customers makes a purchase, only the customer gets the confirmation email, none is sent to the store admin.
  • When ANY customers order status is changed by the store owner/admin, they ALL receive email notification.

One thing I did notice in your post is that you mention 'reconfigured the code in class.smtp.php', do I need to modify these files? The readme doesn't mention it?

 

 

Just one more thing that I may be misunderstanding here are some settings in the actual site hosting control panel for the domain. Like I mentioned earlier, godaddy.com are the registrars of my domain www.uploadyourbusiness.com and that's also where I created the email account. However, that domain name is forwarded to my site which is hosted at webhost4life.com. Now, webhost4life have a DNS section in the web control panel which allows me to set DNS records for www.uploadyourbusiness.com as shown below:

 

uybdns.gif

 

Now my eyes are bleeding... :o can you help....please..

Share this post


Link to post
Share on other sites

Well from what you say and have done .. everything should work in my mind.

 

I guess your best bet would be to ugrade the oscommerce smtp class.

I mentioned it and am sorry. Yes it is not a mod from the osc community.

 

It upgrades your smtp class from v1.02 to 1.05

 

I would try it .. what have you got to lose.

 

Heres the instructions .. as I do not remember where I got them from. Then you will have to download the files from the site below and and make a small modification to your email.php files to point them to the new class.smtp.inc files. Don't forget to put your settings from your post in the class.smtp.inc files.

 

heres the link for class.smtp.inc v1.05

 

http://www.phpguru.org/downloads/smtp/

Share this post


Link to post
Share on other sites

Thanks for that, I'll give it a try now on my test site.

 

Just one question regarding the part in you rpost

Heres the instructions .. as I do not remember where I got them from. Then you will have to download the files from the site below and and make a small modification to your email.php files to point them to the new class.smtp.inc files. Don't forget to put your settings from your post in the class.smtp.inc files.

 

Is that all the instructions once I download the files?

 

Thanks again,

 

Marcus.

Share this post


Link to post
Share on other sites

Oh .. Sorry .. Stupid Me LOL!

 

Heres the install instructions:

 

Original Author: chen binghua

Modified By: Ray Knapp

 

XXXXXX-----XXXXX

Open and edit the class.smtp.inc

 

EDIT THE HOST, USERNAME, PASSWORD.

 

Upload the class.smtp.inc to catalog/includes/classes/ AND /admin/includes/classes/

 

XXXXXX-----XXXXX

 

Open and edit the email.php file in both catalog/includes/classes/

and /admin/includes/classes/

 

"EDIT THE HOST, HELO, USERNAME, PASSWORD."

 

FIND THE FOLLOWING LINE:

 

if (EMAIL_TRANSPORT == 'smtp') {

 

JUST BELOW IT REPLACE:

 

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

 

WITH THE FOLLOWING:

 

// begin smtp authentication

 

include(DIR_WS_INCLUDES . '/classes/class.smtp.inc');

// use this: include_once(DIR_WS_INCLUDES . '/classes/class.smtp.inc'); if get Cannot Redeclare Class SMTP Error

// The smtp server host/ip

$params['host'] = 'localhost';

// The smtp server port

$params['port'] = 25;

// What to use when sending the helo command. Typically, your domain/hostname

$params['helo'] = 'terracomp.ca';

// Whether to use basic authentication or not

$params['auth'] = TRUE;

// Username for authentication

$params['user'] = 'admin@terracomp.ca';

// Password for authentication

$params['pass'] = 'minty29minty34';

// 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

 

XXXXX-----XXXXX

WILL NOT WORK WITH EXTRA ORDER EMAILS

Go to admin

Select configuration / Send extra order emails to:

Make sure it is blank

 

________________________________________________________________________________

________________________________

 

// Fix For SMTP Errors

 

 

The parts that were sending the junk info were:

 

CODE

$send_params['headers'] = array("From: your email address ", "To: $to_addr", "Subject: $subject");

and CODE

$send_params['from'] = 'your email address';

 

 

For the headers section I changed : CODE

From: your email address ",

to CODE

"From: Egregore Publishing <webpurchase@egregorepublishing.com>",

and changed :

CODE

$send_params['from'] = 'your email address';

to: CODE

$send_params['from'] = 'office@egregorepublishing.com';

 

 

Now e-mails are sent to me. To fix the problem of me sending e-mails to my customers, I installed the contribution in the admin section the same way that I did in the catalog area, and applied the fixes that I noted above. Everything works just fine.

 

I hope this helps others that have had the same problems that I had.

Share this post


Link to post
Share on other sites

Sorry about that time delay, I'm testing it between bouts of illness due to food poisoning I've had this week :blink:

 

I installed it and it looked like it was all working then the hotmail customer account started playing up. Is the osC email normally stable? It seems to be okay sometimes, but not all the time?!

Share this post


Link to post
Share on other sites

Were you able to get things sorted out? I have not had any problems with email other than when I go mucking around adding tons of mods and code .. but usually get it figured out. Right now though my create account file is so congested with code I have lost my email notification for new accounts ... I am trying to figure out where the problem is. But all in all things seem pretty stable.

 

I have to say I have not tried email to any of the free email account hosts like hotmail ... but I can say even with other software such as outlook express I used to be able to set up to retrieve hotmail. Now they have purposely made it impossible because they keep changing their login scripts all the time. So I just ditched them. I use yahoo mail and they are always consistent.

 

Oh and in the post above I never did the bottom part where he changed the email headers etc. I just did the top code for the smtp upgrade. I just found that last piece below the black separation line in a forum or something.

Share this post


Link to post
Share on other sites

Hi insomniac2,

I copied the class files and modified the email.php files as per your instructions and it all seems to be working fine now, thanks!

 

New user email - OK

New Order Email to customer & Admin - OK

Password reminder Email - OK

Admin to Customer Email - OK

Newsletter Email - OK

Order Update to Customer Email - OK

 

Not too sure on the product notification yet as I need to read up on how that actually works anyway.

 

I also added a mod mentioned here http://forums.oscommerce.com/index.php?showtopic=131666&hl=

 

It mentions that this -f attribute could also prevent emails getting sent from the osC application being stopped by spam filters on SMTP servers due to the mails not contain a valid email sender address. Not sure if it's needed in my case but I installed it anyway and the emails still come through fine.

 

Another mod I found but did not use was for ISP's blocking emails, but will see how my current setup goes before using it http://forums.oscommerce.com/index.php?sho...94entry702994

 

Thanks for you help with this, I appreciate it!

 

Marcus :thumbsup:

 

ps:- Who hosts your site? I have been looking into dedicated server V's Co-Location hosting rather than using my current shared setup.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×