Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Backend Errors - SMTP


kez

Recommended Posts

Posted

Hi,

 

I've installed a wamp package on w2k for test purpose.

 

After registering a new user I was getting the following two errors:

 

Warning: mail() [function.mail]: SMTP server response: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html in c:\wamp\www\includes\classes\email.php on line 502

 

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\includes\classes\email.php:502) in c:\wamp\www\includes\functions\general.php on line 29

 

As a result of this I have been searching for a solution and have made one change: in file php.ini I have set

SMTP = smtp.mymailserver.com

 

The two errors thus change and apparently reduce slightly to:

Warning: mail() [function.mail]: SMTP server response: 501 Bad address syntax in c:\wamp\www\admin\includes\classes\email.php on line 500

 

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\admin\includes\classes\email.php:500) in c:\wamp\www\admin\includes\functions\general.php on line 18

 

The code around line 500 in file email.php is:

/**

* Sends the mail.

*/

 

function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') {

$to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr);

$from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr);

 

if (is_string($headers)) {

$headers = explode($this->lf, trim($headers));

}

 

for ($i=0; $i<count($headers); $i++) {

if (is_array($headers[$i])) {

for ($j=0; $j<count($headers[$i]); $j++) {

if ($headers[$i][$j] != '') {

$xtra_headers[] = $headers[$i][$j];

}

}

}

 

if ($headers[$i] != '') {

$xtra_headers[] = $headers[$i];

}

}

 

if (!isset($xtra_headers)) {

$xtra_headers = array();

}

 

if (EMAIL_TRANSPORT == 'smtp') {

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

}

}

 

/**

 

I tried changing line 499 to

(EMAIL_TRANSPORT == 'smtp.mymailserver.com')

but this resulted in no difference to the output.

I subsequently pinged the smtp server and it was live.

 

The email transport method is set through the backend: Administration --> Configuration --> Email Options ( http://localhost/admin/configuration.php ) to "SMTP"

 

The store email addresses have been configured through the backend: Administration --> Configuration --> My Store ( http://localhost/admin/configuration.php ) in simple mail format [email protected] ( i.e., not root@localhost ).

 

I've removed any trailing spaces ( or anything else ) after the last >? in the files

...\includes\classes\email.php

...\includes\functions\general.php

and again checked for the error. It's still there.

 

I've done quite a bit of reading and have found that I can supress the errors and render the next page by putting "@" in front of "mail(" on line 500 ( as above ). But it dosen't send the mail.

 

On the other hand with this "@" still in place if I go under "Administration --> Tools --> Send email" ( which is http://localhost/admin/mail.php ) I can send a customer mail with out problem.

 

This is all making me believe there is something bad in the syntax on line 500.

Does Line 500 apply to sendmail and not to w2k implementation with SMTP server ( located elsewhere ). If so, not knowing very much about PHP what should I replace the line 500 with ?

 

I have found some code snippets suggesting that

ini_set(SMTP,"smtp.mymailserver.com");

ini_set(smtp_port,25);"

or something similar could be used around line 500 but I do know PHP so do not understand how thes snippents might be used.

 

Ref Link #1: http://www.oscommerce.com/forums/lofiversion/i...php/t99581.html

Ref Link #2: http://www.phpfreaks.com/phpmanual/page/fu...pic_id=3652#top

 

Regards, Kez

 

 

The code around line 18 in file general.php is:

 

////

// Redirect to another page or site

function tep_redirect($url) {

global $logger;

 

LINE 18 --> header('Location: ' . $url);

 

if (STORE_PAGE_PARSE_TIME == 'true') {

if (!is_object($logger)) $logger = new logger;

$logger->timer_stop();

}

 

exit;

}

 

////

Posted
Hi,

 

I've installed a wamp package on w2k for test purpose.

 

After registering a new user I was getting the following two errors:

 

Warning: mail() [function.mail]: SMTP server response: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html in c:\wamp\www\includes\classes\email.php on line 502

 

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\includes\classes\email.php:502) in c:\wamp\www\includes\functions\general.php on line 29

 

As a result of this I have been searching for a solution and have made one change: in file php.ini I have set

SMTP = smtp.mymailserver.com

 

The two errors thus change and apparently reduce slightly to:

Warning: mail() [function.mail]: SMTP server response: 501 Bad address syntax in c:\wamp\www\admin\includes\classes\email.php on line 500

 

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\admin\includes\classes\email.php:500) in c:\wamp\www\admin\includes\functions\general.php on line 18

 

The code around line 500 in file email.php is:

/**

* Sends the mail.

*/

 

    function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') {

      $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr);

      $from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr);

 

      if (is_string($headers)) {

        $headers = explode($this->lf, trim($headers));

      }

 

      for ($i=0; $i<count($headers); $i++) {

        if (is_array($headers[$i])) {

          for ($j=0; $j<count($headers[$i]); $j++) {

            if ($headers[$i][$j] != '') {

              $xtra_headers[] = $headers[$i][$j];

            }

          }

        }

 

        if ($headers[$i] != '') {

          $xtra_headers[] = $headers[$i];

        }

      }

 

      if (!isset($xtra_headers)) {

        $xtra_headers = array();

      }

 

      if (EMAIL_TRANSPORT == 'smtp') {

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

      }

    }

 

/**

 

I tried changing line 499 to

(EMAIL_TRANSPORT == 'smtp.mymailserver.com')

but this resulted in no difference to the output.

I subsequently pinged the smtp server and it was live.

 

The email transport method is set through the backend: Administration --> Configuration --> Email Options ( http://localhost/admin/configuration.php )  to "SMTP"

 

The store email addresses have been configured through the backend: Administration --> Configuration --> My Store ( http://localhost/admin/configuration.php ) in simple mail format [email protected] ( i.e., not root@localhost ).

 

I've removed any trailing spaces ( or anything else ) after the last >? in the files

...\includes\classes\email.php

...\includes\functions\general.php

and again checked for the error. It's still there.

 

I've done quite a bit of reading and have found that I can supress the errors and render the next page by putting "@" in front of "mail(" on line 500 ( as above ). But it dosen't send the mail.

 

On the other hand with this "@" still in place if I go under "Administration --> Tools --> Send email" ( which is http://localhost/admin/mail.php ) I can send a customer mail with out problem.

 

This is all making me believe there is something bad in the syntax on line 500.

Does Line 500 apply to sendmail and not to w2k implementation with SMTP server ( located elsewhere ). If so, not knowing very much about PHP what should  I replace the line 500 with ?

 

I have found some code snippets suggesting that

ini_set(SMTP,"smtp.mymailserver.com");

ini_set(smtp_port,25);"

or something similar could be used around line 500 but I do know PHP so do not understand how thes snippents might be used.

 

Ref Link #1: http://www.oscommerce.com/forums/lofiversion/i...php/t99581.html

Ref Link #2: http://www.phpfreaks.com/phpmanual/page/fu...pic_id=3652#top

 

Regards, Kez

The code around line 18 in file general.php is:

 

////

// Redirect to another page or site

  function tep_redirect($url) {

    global $logger;

 

LINE 18 -->  header('Location: ' . $url);

 

    if (STORE_PAGE_PARSE_TIME == 'true') {

      if (!is_object($logger)) $logger = new logger;

      $logger->timer_stop();

    }

 

    exit;

  }

 

////

 

 

try in php.ini :

 

SMTP = mymailserver.com

Treasurer MFC

Posted

Thanks Boxtel,

 

I've tried

SMTP = mymailserver.com

without a breakthrough.

 

I'm of the view that this may be something to do with swapping the code around line 500 out for a short "ini_set(" command though I do not know how to do this.

 

Regards, Kez

Archived

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

×
×
  • Create New...