Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

send mail not work- from admin panel works fine


Guest

Recommended Posts

hello,

first all i read 100+ post for found solution on my problem no one helps..

Send mail from admin page-news letter works fine ( all customer recieve mail ok )

only send mail from contact us page i dont receive.

 

if i use my webshop mail adres ( [email protected]) into contact us page mail is received.

any other mail adres in contact us i dont receive mail.

 

hope there is some one can help me.

thank you GR. From netherlands.

Link to comment
Share on other sites

You may want to try this:

 

Click Me

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

The Contact Us page use the following two parameters to create the To: email address:

 

admin -> configuration -> my store -> Store Owner

admin -> configuration -> my store -> E-Mail Address

 

Are these parameters defined correctly? The Store Owner is your name without quotes (e.g., John Smith); the E-Mail Address parameter is a bare internet style email address (e.g., [email protected] - no quotes or <> characters).

 

The admin side uses the E-Mail From parameter as the source address of newsletters / emails.

 

It sounds like one of the two front side parameters are incorrectly defined since your admin side email is working.

 

Ben

Link to comment
Share on other sites

thank you for answer germ i did what u write but still not work

 

i check spam mail box but also nothing there before/after chang

 

----------------------------------------------------------

btopelar ;

-Mail Transport Method sendmail

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails true

Verify E-Mail Addresses Through DNS true

Send E-Mails true

Link to comment
Share on other sites

i can still send mail from my admin panel/news letter.

i can send mail from my contact page when i use my domain mail was working but i dont know after new changs or last changs no more work

Link to comment
Share on other sites

If what I suggested doesn't work, change the file back the way it was.

 

Did you read what bpopelar posted:

 

The Contact Us page use the following two parameters to create the To: email address:

 

admin -> configuration -> my store -> Store Owner

admin -> configuration -> my store -> E-Mail Address

 

Are these parameters defined correctly? The Store Owner is your name without quotes (e.g., John Smith); the E-Mail Address parameter is a bare internet style email address (e.g., [email protected] - no quotes or <> characters).

:unsure:

 

That's something to check.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

i chang it back still not work..

after chang takes some minuuts or must work directly ?

its possibel i chang somethink before your changs so after last changs was from admin panel not working..

i will try orig state and test and after your chang and test if still no work i will post here again.

 

------------------------------------------

QUOTE

The Contact Us page use the following two parameters to create the To: email address:

 

admin -> configuration -> my store -> Store Owner

admin -> configuration -> my store -> E-Mail Address

 

Are these parameters defined correctly? The Store Owner is your name without quotes (e.g., John Smith); the E-Mail Address parameter is a bare internet style email address (e.g., [email protected] - no quotes or <> characters).

 

i dont undestand what i have to test/chang with this can u pls explain or give me just code where i need edit ?

Link to comment
Share on other sites

after chang to old state ( your codes are deleted / changed back to old state ) send mail from contact us with my domain ( [email protected] ) work again..

 

but still any other mail not work from contact us

Link to comment
Share on other sites

send mail from admin no work but im sure 1-2 week ago i send mail to 90-100 customer which registered on webshop from admin panel and all was ok ( i have 2 test mail between registered customer/mail list )

Link to comment
Share on other sites

Does your hosting company require SMTP authentication (sometimes called "password authentication")?

 

The hosting company may have the email server configured to only accept email message from the local domain unless the email connection is authenticated.

 

The other possibility is to try adding the -f option to the mail call in includes/classes/email.php and admin/includes/classes/email.php. There are two calls in each file with slightly different parameters; leave the parameters alone (don't change them), just add the extra parameter:

 

FIND:

 

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

 

REPLACE WITH:

 

$params = "-f$from_addr";

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

 

 

Ben

Link to comment
Share on other sites

thank you for answer

i did changs but still not work

my hosting is yahoo geocities and require SMTP authentication as i know.

still same prob. @mydomain.com works for send mail from contact us but any other mail adress doenst work..

here my email php codes. ;

 

-------------------------------

 

inc/classes/email.php...

 

-----

<?php

/*

$Id: email.php,v 1.12 2003/06/17 17:29:44 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

 

mail.php - a class to assist in building mime-HTML eMails

 

The original class was made by Richard Heyes <[email protected]>

and can be found here: http://www.phpguru.org

 

Renamed and Modified by Jan Wildeboer for osCommerce

*/

 

class email {

var $html;

var $text;

var $output;

var $html_text;

var $html_images;

var $image_types;

var $build_params;

var $attachments;

var $headers;

 

function email($headers = '') {

if ($headers == '') $headers = array();

 

$this->html_images = array();

$this->headers = array();

 

if (EMAIL_LINEFEED == 'CRLF') {

$this->lf = "rn";

} else {

$this->lf = "n";

}

 

/**

* If you want the auto load functionality

* to find other mime-image/file types, add the

* extension and content type here.

*/

 

$this->image_types = array('gif' => 'image/gif',

'jpg' => 'image/jpeg',

'jpeg' => 'image/jpeg',

'jpe' => 'image/jpeg',

'bmp' => 'image/bmp',

'png' => 'image/png',

'tif' => 'image/tiff',

'tiff' => 'image/tiff',

'swf' => 'application/x-shockwave-flash');

 

$this->build_params['html_encoding'] = 'quoted-printable';

$this->build_params['text_encoding'] = '7bit';

$this->build_params['html_charset'] = constant('CHARSET');

$this->build_params['text_charset'] = constant('CHARSET');

$this->build_params['text_wrap'] = 998;

 

/**

* Make sure the MIME version header is first.

*/

 

$this->headers[] = 'MIME-Version: 1.0';

 

reset($headers);

while (list(,$value) = each($headers)) {

if (tep_not_null($value)) {

$this->headers[] = $value;

}

}

}

 

/**

* This function will read a file in

* from a supplied filename and return

* it. This can then be given as the first

* argument of the the functions

* add_html_image() or add_attachment().

*/

 

function get_file($filename) {

$return = '';

 

if ($fp = fopen($filename, 'rb')) {

while (!feof($fp)) {

$return .= fread($fp, 1024);

}

fclose($fp);

 

return $return;

} else {

return false;

}

}

 

/**

* Function for extracting images from

* html source. This function will look

* through the html code supplied by add_html()

* and find any file that ends in one of the

* extensions defined in $obj->image_types.

* If the file exists it will read it in and

* embed it, (not an attachment).

*

* Function contributed by Dan Allen

*/

 

function find_html_images($images_dir) {

// Build the list of image extensions

while (list($key, ) = each($this->image_types)) {

$extensions[] = $key;

}

 

preg_match_all('/"([^"]+.(' . implode('|', $extensions).'))"/Ui', $this->html, $images);

 

for ($i=0; $i<count($images[1]); $i++) {

if (file_exists($images_dir . $images[1][$i])) {

$html_images[] = $images[1][$i];

$this->html = str_replace($images[1][$i], basename($images[1][$i]), $this->html);

}

}

 

if (tep_not_null($html_images)) {

// If duplicate images are embedded, they may show up as attachments, so remove them.

$html_images = array_unique($html_images);

sort($html_images);

 

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

if ($image = $this->get_file($images_dir . $html_images[$i])) {

$content_type = $this->image_types[substr($html_images[$i], strrpos($html_images[$i], '.') + 1)];

$this->add_html_image($image, basename($html_images[$i]), $content_type);

}

}

}

}

 

/**

* Adds plain text. Use this function

* when NOT sending html email

*/

 

function add_text($text = '') {

$this->text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);

}

 

/**

* Adds a html part to the mail.

* Also replaces image names with

* content-id's.

*/

 

function add_html($html, $text = NULL, $images_dir = NULL) {

$this->html = tep_convert_linefeeds(array("rn", "n", "r"), '<br>', $html);

$this->html_text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);

 

if (isset($images_dir)) $this->find_html_images($images_dir);

}

 

/**

* Adds an image to the list of embedded

* images.

*/

 

function add_html_image($file, $name = '', $c_type='application/octet-stream') {

$this->html_images[] = array('body' => $file,

'name' => $name,

'c_type' => $c_type,

'cid' => md5(uniqid(time())));

}

 

/**

* Adds a file to the list of attachments.

*/

 

function add_attachment($file, $name = '', $c_type='application/octet-stream', $encoding = 'base64') {

$this->attachments[] = array('body' => $file,

'name' => $name,

'c_type' => $c_type,

'encoding' => $encoding);

}

 

/**

* Adds a text subpart to a mime_part object

*/

 

/* HPDL PHP3 */

// function &add_text_part(&$obj, $text) {

function add_text_part(&$obj, $text) {

$params['content_type'] = 'text/plain';

$params['encoding'] = $this->build_params['text_encoding'];

$params['charset'] = $this->build_params['text_charset'];

 

if (is_object($obj)) {

return $obj->addSubpart($text, $params);

} else {

return new mime($text, $params);

}

}

 

/**

* Adds a html subpart to a mime_part object

*/

 

/* HPDL PHP3 */

// function &add_html_part(&$obj) {

function add_html_part(&$obj) {

$params['content_type'] = 'text/html';

$params['encoding'] = $this->build_params['html_encoding'];

$params['charset'] = $this->build_params['html_charset'];

 

if (is_object($obj)) {

return $obj->addSubpart($this->html, $params);

} else {

return new mime($this->html, $params);

}

}

 

/**

* Starts a message with a mixed part

*/

 

/* HPDL PHP3 */

// function &add_mixed_part() {

function add_mixed_part() {

$params['content_type'] = 'multipart/mixed';

 

return new mime('', $params);

}

 

/**

* Adds an alternative part to a mime_part object

*/

 

/* HPDL PHP3 */

// function &add_alternative_part(&$obj) {

function add_alternative_part(&$obj) {

$params['content_type'] = 'multipart/alternative';

 

if (is_object($obj)) {

return $obj->addSubpart('', $params);

} else {

return new mime('', $params);

}

}

 

/**

* Adds a html subpart to a mime_part object

*/

 

/* HPDL PHP3 */

// function &add_related_part(&$obj) {

function add_related_part(&$obj) {

$params['content_type'] = 'multipart/related';

 

if (is_object($obj)) {

return $obj->addSubpart('', $params);

} else {

return new mime('', $params);

}

}

 

/**

* Adds an html image subpart to a mime_part object

*/

 

/* HPDL PHP3 */

// function &add_html_image_part(&$obj, $value) {

function add_html_image_part(&$obj, $value) {

$params['content_type'] = $value['c_type'];

$params['encoding'] = 'base64';

$params['disposition'] = 'inline';

$params['dfilename'] = $value['name'];

$params['cid'] = $value['cid'];

 

$obj->addSubpart($value['body'], $params);

}

 

/**

* Adds an attachment subpart to a mime_part object

*/

 

/* HPDL PHP3 */

// function &add_attachment_part(&$obj, $value) {

function add_attachment_part(&$obj, $value) {

$params['content_type'] = $value['c_type'];

$params['encoding'] = $value['encoding'];

$params['disposition'] = 'attachment';

$params['dfilename'] = $value['name'];

 

$obj->addSubpart($value['body'], $params);

}

 

/**

* Builds the multipart message from the

* list ($this->_parts). $params is an

* array of parameters that shape the building

* of the message. Currently supported are:

*

* $params['html_encoding'] - The type of encoding to use on html. Valid options are

* "7bit", "quoted-printable" or "base64" (all without quotes).

* 7bit is EXPRESSLY NOT RECOMMENDED. Default is quoted-printable

* $params['text_encoding'] - The type of encoding to use on plain text Valid options are

* "7bit", "quoted-printable" or "base64" (all without quotes).

* Default is 7bit

* $params['text_wrap'] - The character count at which to wrap 7bit encoded data.

* Default this is 998.

* $params['html_charset'] - The character set to use for a html section.

* Default is iso-8859-1

* $params['text_charset'] - The character set to use for a text section.

* - Default is iso-8859-1

*/

 

/* HPDL PHP3 */

// function build_message($params = array()) {

function build_message($params = '') {

if ($params == '') $params = array();

 

if (count($params) > 0) {

reset($params);

while(list($key, $value) = each($params)) {

$this->build_params[$key] = $value;

}

}

 

if (tep_not_null($this->html_images)) {

reset($this->html_images);

while (list(,$value) = each($this->html_images)) {

$this->html = str_replace($value['name'], 'cid:' . $value['cid'], $this->html);

}

}

 

$null = NULL;

$attachments = ((tep_not_null($this->attachments)) ? true : false);

$html_images = ((tep_not_null($this->html_images)) ? true : false);

$html = ((tep_not_null($this->html)) ? true : false);

$text = ((tep_not_null($this->text)) ? true : false);

 

switch (true) {

case (($text == true) && ($attachments == false)):

/* HPDL PHP3 */

// $message =& $this->add_text_part($null, $this->text);

$message = $this->add_text_part($null, $this->text);

break;

case (($text == false) && ($attachments == true) && ($html == false)):

/* HPDL PHP3 */

// $message =& $this->add_mixed_part();

$message = $this->add_mixed_part();

 

for ($i=0; $i<count($this->attachments); $i++) {

$this->add_attachment_part($message, $this->attachments[$i]);

}

break;

case (($text == true) && ($attachments == true)):

/* HPDL PHP3 */

// $message =& $this->add_mixed_part();

$message = $this->add_mixed_part();

$this->add_text_part($message, $this->text);

 

for ($i=0; $i<count($this->attachments); $i++) {

$this->add_attachment_part($message, $this->attachments[$i]);

}

break;

case (($html == true) && ($attachments == false) && ($html_images == false)):

if (tep_not_null($this->html_text)) {

/* HPDL PHP3 */

// $message =& $this->add_alternative_part($null);

$message = $this->add_alternative_part($null);

$this->add_text_part($message, $this->html_text);

$this->add_html_part($message);

} else {

/* HPDL PHP3 */

// $message =& $this->add_html_part($null);

$message = $this->add_html_part($null);

}

break;

case (($html == true) && ($attachments == false) && ($html_images == true)):

if (tep_not_null($this->html_text)) {

/* HPDL PHP3 */

// $message =& $this->add_alternative_part($null);

$message = $this->add_alternative_part($null);

$this->add_text_part($message, $this->html_text);

/* HPDL PHP3 */

// $related =& $this->add_related_part($message);

$related = $this->add_related_part($message);

} else {

/* HPDL PHP3 */

// $message =& $this->add_related_part($null);

// $related =& $message;

$message = $this->add_related_part($null);

$related = $message;

}

$this->add_html_part($related);

 

for ($i=0; $i<count($this->html_images); $i++) {

$this->add_html_image_part($related, $this->html_images[$i]);

}

break;

case (($html == true) && ($attachments == true) && ($html_images == false)):

/* HPDL PHP3 */

// $message =& $this->add_mixed_part();

$message = $this->add_mixed_part();

if (tep_not_null($this->html_text)) {

/* HPDL PHP3 */

// $alt =& $this->add_alternative_part($message);

$alt = $this->add_alternative_part($message);

$this->add_text_part($alt, $this->html_text);

$this->add_html_part($alt);

} else {

$this->add_html_part($message);

}

 

for ($i=0; $i<count($this->attachments); $i++) {

$this->add_attachment_part($message, $this->attachments[$i]);

}

break;

case (($html == true) && ($attachments == true) && ($html_images == true)):

/* HPDL PHP3 */

// $message =& $this->add_mixed_part();

$message = $this->add_mixed_part();

 

if (tep_not_null($this->html_text)) {

/* HPDL PHP3 */

// $alt =& $this->add_alternative_part($message);

$alt = $this->add_alternative_part($message);

$this->add_text_part($alt, $this->html_text);

/* HPDL PHP3 */

// $rel =& $this->add_related_part($alt);

$rel = $this->add_related_part($alt);

} else {

/* HPDL PHP3 */

// $rel =& $this->add_related_part($message);

$rel = $this->add_related_part($message);

}

$this->add_html_part($rel);

 

for ($i=0; $i<count($this->html_images); $i++) {

$this->add_html_image_part($rel, $this->html_images[$i]);

}

 

for ($i=0; $i<count($this->attachments); $i++) {

$this->add_attachment_part($message, $this->attachments[$i]);

}

break;

}

 

if ( (isset($message)) && (is_object($message)) ) {

$output = $message->encode();

$this->output = $output['body'];

 

reset($output['headers']);

while (list($key, $value) = each($output['headers'])) {

$headers[] = $key . ': ' . $value;

}

 

$this->headers = array_merge($this->headers, $headers);

 

return true;

} else {

return false;

}

}

 

/**

* 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') {

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 {

$params = "-f$from_addr";

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

}

}

 

/**

* Use this method to return the email

* in message/rfc822 format. Useful for

* adding an email to another email as

* an attachment. there's a commented

* out example in example.php.

*

* string get_rfc822(string To name,

* string To email,

* string From name,

* string From email,

* [string Subject,

* string Extra headers])

*/

 

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

// Make up the date header as according to RFC822

$date = 'Date: ' . date('D, d M y H:i:s');

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

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

 

if (is_string($subject)) {

$subject = 'Subject: ' . $subject;

}

 

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

}

 

$headers = array_merge($this->headers, $xtra_headers);

 

return $date . $this->lf . $from . $this->lf . $to . $this->lf . $subject . $this->lf . implode($this->lf, $headers) . $this->lf . $this->lf . $this->output;

}

}

?>

 

----------------------------------

 

 

 

Does your hosting company require SMTP authentication (sometimes called "password authentication")?

 

The hosting company may have the email server configured to only accept email message from the local domain unless the email connection is authenticated.

 

The other possibility is to try adding the -f option to the mail call in includes/classes/email.php and admin/includes/classes/email.php. There are two calls in each file with slightly different parameters; leave the parameters alone (don't change them), just add the extra parameter:

 

FIND:

 

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

 

REPLACE WITH:

 

$params = "-f$from_addr";

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

Ben

Link to comment
Share on other sites

some more info;

 

SMTP localhost localhost

 

SERVER["SERVER_SOFTWARE"] Apache/1.3.37 (Unix) FrontPage/5.0.2.2510 mod_fastcgi/2.4.2

 

sendmail_from no value no value

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

-----------------------------------------------------------------------------------

 

E-Mail Transport Method sendmail

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails true

Verify E-Mail Addresses Through DNS true

Send E-Mails true

E-Mail Transport Method

Link to comment
Share on other sites

As your hosting company requires SMTP Authentication, you need to add this contribution to your web site.

 

I don't think your SMTP server is located at localhost. You'll need to contact your hosting company and ask them for the hostname and port number of the SMTP server for your website.

 

Follow the installation instruction included in README file.

 

Ben

Link to comment
Share on other sites

thank you very much for all your answer.

i think this will real working solution for all yahoo-geocities hosting users,

 

just another question ;

its possibel to make solution like ;

- in contact us page i ask to customer

* mail adres

* name

* Enquiry

if i dont ask customer mail adress ( and in php code i chang mail adress to my domain mail adress like its customer mail into php code but i use my domain mail so all mail can receive )

and i make small addon in php code like not only ask for name/mail adress/Enquiry but name/Enquiry/ and mail adress but this question into php code is not like mail adres requestion but like name and last name so php code still send all mail from my domain mail but i can see customer mail adress ...

i think this is small chang than add totaly new codes...

 

sorry for my bad english.

and i hope this is as i think just small code chang if so waiting your help how to do.

 

best regards

 

 

As your hosting company requires SMTP Authentication, you need to add this contribution to your web site.

 

I don't think your SMTP server is located at localhost. You'll need to contact your hosting company and ask them for the hostname and port number of the SMTP server for your website.

 

Follow the installation instruction included in README file.

 

Ben

Link to comment
Share on other sites

thank you very much for all your answer.

i think this will real working solution for all yahoo-geocities hosting users,

 

just another question ;

its possibel to make solution like ;

- in contact us page i ask to customer

* mail adres

* name

* Enquiry

if i dont ask customer mail adress ( and in php code i chang mail adress to my domain mail adress like its customer mail into php code but i use my domain mail so all mail can receive )

and i make small addon in php code like not only ask for name/mail adress/Enquiry but name/Enquiry/ and mail adress but this question into php code is not like mail adres requestion but like name and last name so php code still send all mail from my domain mail but i can see customer mail adress ...

i think this is small chang than add totaly new codes...

 

sorry for my bad english.

and i hope this is as i think just small code chang if so waiting your help how to do.

 

best regards

If I understand you correctly, what you are asking for is exactly what Germ suggested in his prior posting.

 

The link he provided makes a minor change to the Contact Us page to include the customer provided name and email address in the body of the email and uses the Store name / email address as the From address (instead of the customer's name / email address).

 

Ben

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...