Jump to content

Archived

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

bscanzoni

SMTP Authentication and OSCommerce

Recommended Posts

The PHPMailer when unzipped consists of many folders and strange files. Do I copy all of this to a new /ext/modules/PHPMailer folder? Or only the PHPMailerAutoload.php?

Share this post


Link to post
Share on other sites

What I did was to add the following files to /ext/modules/PHPMailer/

 

- class.phpmailer.php

- class.pop3.php

- class.smtp.php

- PHPMailerAutoload.php

 

I have added the two email.php in:

 

- includes/classes/

- admin/includes/classes/

 

I have made the changes to admin/includes/functions/general.php and I have done an sql update using MySql

 

I have changed the following settings in admin:

 

- email transport method: smtp

- email line feeds: LF

- use mime html when sending: false

- verify email adress through DNS: false

- send emails: true

- smtp host: <my smtp host>

- smtp authentication: true

- smtp password: <my password>

- smtp user: <my user id>

- smtp reply to: <store mail adress>

 

Now I don't even get an order mail. Before it was only our customers that did not get an order confirmation. It's not even possible to use contact us. What have I missed?

Share this post


Link to post
Share on other sites

I need some error log to see problem

 

There are debug functions.

 

Find in email class:

   var $debug = 0;
   var $debug_output = 'error_log';

 

$debug could be 0,1,2,3 or 4 level

$debug_output could be 'error_log' as standard or screen with 'echo' parameter

 

Probably will help this parameter:

 

$debug_output = 'echo';

$debug = 2;

 

I suggest to test on admin site. I used send email for myself in Tools/Newsletter

 

The main problem could be the sender email or Extra email address combined with name in configs. (Example: My Name <my@@address.com> is bad)


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

I'm sorry, but I think we don't speak the same language. I don't understand how to perform a debug.What do you mean by "find in email class"?

Share this post


Link to post
Share on other sites

admin/includes/classes/email.php


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

OK, I will try that. Before doing so I have two questions:

 

- is there no modification to includes/functions/general.php?

- where do I set the port for email. In my case it should be port 465

Share this post


Link to post
Share on other sites

ONe thing to know for anyone reading this is port 465 and 587 should always be SSL ports. I don't know if there is a setting in phpmailer for that but if there is you will need to select SSL. It's especially important if you are connecting from outside the server like on your home PC using Outlook or the like.


I'm not really a dog.

Share this post


Link to post
Share on other sites

In catalog/includes/classses/email.php and admin/includes/classses/email.phpyou can predefine port.

 

Example:

  $phpMail->Port = 465;


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

This mod use default tep_mail functions. I dont see any code from your core. I drop out totaly the header handling and add a simple attachment function only.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

For SSL ports you have to predefine the ssl protocol by this way:

$phpMail->SMTPSecure = 'ssl';


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

It doesn't work despite changing the port to 465 and changed to ssl. Someone else that has any idea or has got this to work? Is it really only the following files from phpmailer I need:

 

- class.phpmailer.php

- class.pop3.php

- class.smtp.php

- PHPMailerAutoload.php

 

I have put these files in the new directory /ext/modules/PHPMailer/

Share this post


Link to post
Share on other sites
It doesn't work
means nothing. What is the error report from PhPMailer?

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

I did change the SMTP host in admin to localhost and now it works. It's possible to send emails using contact us page and it's also possible to order. Problem now is that a customer gets two order confirmation mails. What can be wrong?

 

Two order confirmations is of course better then none.

Share this post


Link to post
Share on other sites

:)

somehow the tep_mail() used twice in order


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

This is why i like mandrill so much :) , it saves allot of headache:

 

function tep_mandrill_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {

if (SEND_EMAILS != 'true') return false;
$uri = 'https://mandrillapp.com/api/1.0/messages/send-template.json';
$postString = '{
"key": "xxxX??Xxxx",
"template_name": "template_name",
"template_content": [
 {
	 "name": "header",
	 "content": "*|HEADERSTUFF|*"
 },
 {
	 "name": "main",
	 "content": "*|CONTENTSTUFF|*"
 },
{
	 "name": "footer",
	 "content": "*|FOOTERSTUFF|*"
 }
],
"message": {
 "subject": "'.$email_subject.'",
 "from_email": "'.$from_email_adress.'",
 "from_name": "'.$from_email_name.'",
 "to": [
	 {
		 "email": "'.$to_email_address.'",
		 "name": "'.$to_name.'"
	 }
 ],
 "important": false,
 "track_opens": true,
 "merge": true,
"merge_vars": [
	 {
		 "rcpt": "'.$to_email_address.'",
		 "vars": [
			 {
				 "name": "HEADERSTUFF",
				 "content": "'.$email_subject.'"
			 },
	 {
				 "name": "CONTENTSTUFF",
				 "content": "'.$email_text.'"
			 },
	 {
				 "name": "FOOTERSTUFF",
				 "content": "other stuff"
			 }
		 ]
	 }
 ],
 "tags": [
	 "whatever_var"
 ]
},
"async": false,
"ip_pool": "Main Pool"
}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_exec($ch);
}

 

to send orders and all other stuff that uses function $message->send ..............

to function tep_mandrill_mail(............

Make sure you remove all "\n" and or "\n\n" line breaks used in the core.

 

And your clients will have a nice templated transactional email

if include urls make sure they are formatted as follow:

 

<a href=\"whateverlink.php\">a link ... a new password url etc etc </a>
// here the \ is the crucial, else mail not send.So no default email markup , but pure html

Share this post


Link to post
Share on other sites

NOTICE: in the language sectionS (inside there is it controlled what could be the SUBJECT or the email BODY content, inside these languages there are also included email markups for line breaks ( "\n") make sure you remove them or replace the defined CONSTANTS with your own.

 

(this should have been attached to the previous post i made, but i was not able anymore to edit it again...... skip this if not went true that one)

Share this post


Link to post
Share on other sites

I don't know what Mandrill is or where to include it. Should this replace PHPMailer? Do you mean that PHPMailer does not work?

 

It must be a lot of people with the same problem and needs smtp authentication. Do you mean there is no good solution for this in Oscommerce?

 

Can somebody tell me where tep_mail() could be used twice in order? Is that in email.php? For orders is it the admin email.php that is used?

 

For some reasons the first mail goes to the customer only. The second mail goes to both the customer and the store mail adress. If I remove "send extra mail to store" only one mail is sent to the customer, however no mail to the store so I can see that an order is placed.

Share this post


Link to post
Share on other sites

tep_mail() used in checkout_process.php and maybe some payment method use it.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

I think from your description that php mail() used instead before tep_mail()


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Since this was not a problem before and nothing is changed in these files the problem must be somewhere else. Don't you agree? I have no payment methods that sends emails.

Share this post


Link to post
Share on other sites

Yes you are right.. there are 2 send_to if send extra email defined. Need fix for it. We should destroy the email list after sending.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

If I look in the modified general php I find one tep mail() and no php mail(). On line 1190 i found this:

 

function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {

if (SEND_EMAILS != 'true') return false;

 

Where could the php mail() be located? It is very difficult to understand the ordering process and where mails are sent.

Share this post


Link to post
Share on other sites

Where do you find the 2 send to? In which file? Can you help me with the code to empty the email list after sending?

Share this post


Link to post
Share on other sites

look at includes/classes/email.php and admin/includes/classes/email.php

 

find:

  if (!$phpMail->Send()) {
    return false;
  }
  return true;
   }
 }
?>

 

change to:

  if (!$phpMail->Send()) {
    return false;
  }
  $phpMail->clearAddresses();
  return true;
   }
 }
?>


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

That I think made it. Only one order confirmation was received. Thank's a lot for your help Gergely. I hope others could use this solution also.

Share this post


Link to post
Share on other sites

×