Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SMTP settings in PHP.ini for e-mail authentication.


blueline

Recommended Posts

Posted

Hey everyone. I recently installed osC on my local machine in order to do some testing. I am having a problem with the SMTP settings in PHP.ini and I keep getting errors when e-mails are to be sent out...like on checkout_process.php. I get the error below. What do I have to do to fix the problem? I have already adjusted php.ini with the smtp settings which you will also find below.

Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini in C:Inetpubwwwrootcatalogincludesclassesemail.php on line 502

 

Warning: Cannot add header information - headers already sent by (output started at C:Inetpubwwwrootcatalogincludesclassesemail.php:502) in C:Inetpubwwwrootcatalogincludesfunctionsgeneral.php on line 23

Current PHP.ini SMTP settings:

[mail function]

; For Win32 only.

SMTP = mail.atl.bellsouth.net; for Win32 only

 

; For Win32 only.

sendmail_from = [email protected] ; for Win32 only

 

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").

;sendmail_path =

email.php lines 499-504

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

} else {

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

}

}

 

Thanks,

Chris

Chris Sullivan

Posted

I used to get that same error:

 

Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini in C:Inetpubwwwrootcatalogincludesclassesemail.php on line 502

 

Warning: Cannot add header information - headers already sent by (output started at C:Inetpubwwwrootcatalogincludesclassesemail.php:502) in C:Inetpubwwwrootcatalogincludesfunctionsgeneral.php on line 23

 

 

Luckily I run both Windows and UNIX. So I noticed I was getting it on Windows but not UNIX with identical osCommerce snap shots. After much head scratching I determined the problem to be that Windows needs "rn" while UNIX only uses "n".

 

I modified the if statement at the line number provided in the error message and problem gone bye bye.

 

Here's the code I use.

 

if (EMAIL_TRANSPORT == 'smtp') {

$this->output = ereg_replace("rn", "n", $this->output);

$this->output = ereg_replace("n", $this->lf, $this->output);

$subject = ereg_replace("rn", "n", $subject);

$subject = ereg_replace("n", $this->lf, $subject);

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

} else {

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

}

 

Hope this helps, let me know if it does.

 

Micah Toland

Posted

i have the same problem. i tried this modified code and i still have problems with the same error on the same line. either sendmail nor smtp are nto working on their appropriate lines of code. is there any other place to setup these variables on a shated server? this is the last thing i need to get working.. grr :wink:

Posted

If you go in the admin, then goto config, then e-mail options. Once you are here you need to change e-mail transport method to smtp and that should solve your problem. It did for me good luck

Posted

Tried that as well, and unfortunately that did not work either.

 

Any more ideas?

Thanks,

Chris

Chris Sullivan

Posted

ive been working with every combination and option as long as this problem has persisted. SMTP and Sendmail are both giving me the same error with a different line number (naturally) from the conditional statement to send.

Posted

I am having a similar problem. Not getting any errors, but I know what the problem is. My server requires authentication when sending mail, my administator said I am going to have to make a script to authenticate before sending.

 

Anyone know how to do this?

 

Will pay $ if you can.

  • 4 months later...
  • 3 months later...
Posted

After looking into all the above, I found that I still had problems emailing the additional addressees in the Send Extra Emails box. I had used the syntax John Doe <[email protected]>, Jane Doe <[email protected]> and that produced similar error messages in email.php, line 500, plus no orders to recipients. What worked for me was to use [email protected],[email protected] and this worked perfectly; just have to leave out their real names and the <> characters. I use Window NT4 for this install. I had no such problems at all using Mac OSX on 2 other store installs, so this might apply only to WindowsNT users.

Archived

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

×
×
  • Create New...