Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Email Not Working


JohnCoates

Recommended Posts

I have been surfing the board for hours and still can not get this fixed

 

This warning came from me trying the email a friend option

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/includes/classes/email.php on line 502

 

Warning: Cannot add header information - headers already sent by (output started at /www/cgi/oscommerce/catalog/includes/classes/email.php:502) in /www/cgi/oscommerce/catalog/includes/functions/general.php on line 29

 

Email not working for admin too

 

FreeServers just added php so I am 100% new at this!

 

This is posted at the Freeservers' site

"We support PHP and Perl scripts. Here is a brief overview to help you install and run your CGI scripts.

 

The location of the Perl interpreter is #!/usr/bin/perl.

 

For is /usr/sbin/sendmail.

 

All CGI scripts must be placed in the /www/cgi/ directory, ( not in /cgi-bin/ ).

To prevent spamming and excessive use of system resources, outbound connections are not allowed, with the exception of the e-mail capabilities already available with your hosting package. Note: We do not permit solicited or unsolicited bulk e-mail. If you do not follow these rules your account will be removed."

 

 

Am I having a server problem or does my sendmail location need to be changed?

 

PLEASE HELP!

Link to comment
Share on other sites

Try adding

ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');

to the top of includes/classes/email.php. Right before the line

  class email {

would be good.

 

Hth,

Matt

Link to comment
Share on other sites

Thanks for the quick reply, but I'm having no luck.

 

I added the code you said and this is what it looks like now

 

 

___________________

 

Renamed and Modified by Jan Wildeboer for osCommerce

*/

 

ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');

class email {

var $html;

var $text;

var $output;

var $html_text;

var $html_images;

var $image_types;

var $build_params;

var $attachments;

var $headers;

___________________________

 

I get the same warning but it moved down a line

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/includes/classes/email.php on line 503

 

Warning: Cannot add header information - headers already sent by (output started at /www/cgi/oscommerce/catalog/includes/classes/email.php:503) in /www/cgi/oscommerce/catalog/includes/functions/general.php on line 29

 

 

Please advise... Did I do it right?

 

Thank you!

Link to comment
Share on other sites

Yes, that's right.

 

I would try making a really simple test_mail.php file:

<?php
ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');
mail('[email protected]', 'Test', 'Is this working?', "From: [email protected]\nMIME-Version: 1.0");
?>

put it in your catalog directory and see if you get the same errors when you try to access it. If so, open a help ticket with your host. If not, post back and we can try to modify the osCommerce mailer to output more like that.

 

Hth,

Matt

Link to comment
Share on other sites

Still not working...

 

I made a page testsemail.php and added the below code

 

______________

 

<?php

ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');

mail('[email protected], 'Test', 'Is this working?', "From: [email protected]\nMIME-Version: 1.0");

?>

 

_____________-

 

I dont get the same warning as before ... the new warning is

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/testsmail.php on line 3

 

Any idea what wrong?

 

Thank a ton for helping me... I've been up all night trying to get it working

Link to comment
Share on other sites

Is there other places I should check to make sure my send mail path is working?

 

I dont know what else to do

 

Please does anyone have a clue?

 

Should I reload the whole program? I called freeservers (myhost) and they said sendmail worked fine... and it was the OSC program, Freeservers has only offered php for about 1 week for their websites.

 

Is it me or is it them?

 

Please refer to my first post for the problem I'm still having

Link to comment
Share on other sites

I also tried using the test script found at http://www.oscommerce.com/community/contributions,1595

 

It still did not work .. These are the warnings it gave me when trying the above email test

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/email_test.php on line 15

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/includes/classes/email.php on line 502

 

 

Here is where I posted the tests sript

 

http://napstermiles.com/cgi/oscommerce/cat.../email_test.php

 

 

But the warnings did change from the warnings on the non-tests script pages that I am still having a fit with http://www.oscommerce.com/forums/index.php?showtopic=65106

 

Please help if you can

 

Thank you

Link to comment
Share on other sites

At this point, you will have to get help from your host. It does not like the sendmail path, even though it's the one that they gave you. Thus, it is pretty clearly a problem with their setup which you will not be able to fix, because you do not have privileges to change their setup.

 

Hth,

Matt

Link to comment
Share on other sites

Could it have something to do with my host making be use /cgi/ and not /cgi-bin/

 

Freeservers' scripting rules

All CGI scripts must be placed in the /www/cgi/ directory, ( not in /cgi-bin/ ).

 

Does this effect the 'sendmail_path' of /usr/sbin/sendmail

 

Freeservers said their sendmail works fine and it was on my end of things???

 

 

By the way Matt I do thank you for being so helpful

 

I just wish we could get it fixed, I really want to turn my website http://www.rfsafe.com into a .php site! I'm sure it will get more people involved and hopefully increase sales too!

 

It drives me crazy to think I've made my living online for 4yrs the hard way "html alone"! The features in php and the osc interface is going to make my life so much easier! I just need to get over the little hills to get rolling.

 

 

Thanks everyone

Link to comment
Share on other sites

Tell them to fix the mini-script, testsemail.php. There is absolutely nothing that can not be working about that. If there is something special about their configuration that it will only work if you do a certain thing, then they need to tell you what that is.

 

Make them give you a working script, even if it only sends a stupid email like that, and we can help you modify the method to work with osCommerce. I'm serious, you're putting way too much worry into figuring out their system. They should help you with that. If they can't/won't, you will be far better off paying a few more bucks to get hosting somewhere that can at least get a script that's only two lines long (4 if you count the php tags) working.

 

sendmail itself may be working. The question is how to get it to work from PHP. They should be able to provide with an example working script for this.

 

Good luck,

Matt

Link to comment
Share on other sites

Freeservers just started offering PHP and

 

 

 

(Q&A off Freeservers Site)

 

Q: Do you have an example of sending mail in PHP?

 

A: By default Pear/Mail.php is installed on your system. Find details at http://www.pear.php.net One example follows:

 

<?php

include('Mail.php');

 

$recipients = '[email protected]';

 

$headers['From'] = '[email protected]';

$headers['To'] = '[email protected]';

$headers['Subject'] = 'Test message 1';

 

$body = 'Test message 1 with the body.';

 

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

 

// Create the mail object using the Mail::factory method

$mail_object =& Mail::factory('smtp', $params);

 

$mail_object->send($recipients, $headers, $body);

print "Sent Mail message to $recipients";

?>

 

 

 

Any take on this? How will this work for OSC?

 

Im sure your will get more of this question from others on the freeservers network making the leap to php!

 

Thanks again

John

Link to comment
Share on other sites

If they can't/won't, you will be far better off paying a few more bucks to get hosting somewhere that can at least get a script that's only two lines long (4 if you count the php tags) working.

 

Dont get me wrong Freeservers is not free, if you want to use php - It's $24.95 a month! So it cost for sure, not to mention the 12hrs I've put in tring to get this so called simple 5 min task done.... Wow what a learning curve

 

Thanks for helping me!

 

John

Link to comment
Share on other sites

I posted the below script in the osc /catalog/ folder and it WORKED!

I sent my first email using php! :D

 

This is the script that worked

 

<?php

include('Mail.php');

 

$recipients = '[email protected]';

 

$headers['From'] = '[email protected]';

$headers['To'] = '[email protected]';

$headers['Subject'] = 'Test message 1';

 

$body = 'Test message 1 with the body.';

 

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

 

// Create the mail object using the Mail::factory method

$mail_object =& Mail::factory('smtp', $params);

 

$mail_object->send($recipients, $headers, $body);

print "Sent Mail message to $recipients";

?>

 

 

So can someone build a hack to use OSC's mail interface on freeservers network?

 

I'm sure you know I'm praying we can after all this

 

Thank you

John

Link to comment
Share on other sites

Still not working...

 

I made a page testsemail.php and added the below code

 

______________

 

<?php

ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');

mail('[email protected], 'Test', 'Is this working?', "From: [email protected]\nMIME-Version: 1.0");

?>

 

_____________-

 

I dont get the same warning as before ... the new warning is

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/testsmail.php on line 3

 

Any idea what wrong?

 

Thank a ton for helping me... I've been up all night trying to get it working

I don't know if you got an answer for this, I've sorta read the rest of the replies here, but got distracted, but I did try your code and did find one error, but got it working.

 

The code should be

 

<?php

ini_set('sendmail_path', '/usr/sbin/sendmail -t -i');

mail('[email protected]', 'Test', 'Is this working?', "From: [email protected]\nMIME-Version: 1.0");

?>

 

 

You missed a ' at the end of .com', 'Test' in the code you supplied.

Best Regards

Link to comment
Share on other sites

Hi,

 

I still have the problem

 

This is the skinny. If I use the Tell A Friend or email from Admin or anything to do with mail - It dont work!

 

I installed oscommerce to freeservers, everything works great but the mail features.

 

This is what I get when using any oscommerce mail operation

 

Warning: Could not execute mail delivery program in /www/cgi/oscommerce/catalog/includes/classes/email.php on line 502

 

Warning: Cannot add header information - headers already sent by (output started at /www/cgi/oscommerce/catalog/includes/classes/email.php:502) in /www/cgi/oscommerce/catalog/includes/functions/general.php on line 29

 

In this thread it was suggested that I use simpler mail forms to locate where the problem was " the server or my code" Well it's kind of neither ones fault. My PHP code is the way is should be but freeservers is using differnet tags and path to their mail server.

 

Here is a php mail script that does work of the freeservers server

 

(Q&A off reeservers Site)

 

Q: Do you have an example of sending mail in PHP?

 

A: By default Pear/Mail.php is installed on my server at freeservers. Find details at http://www.pear.php.net One example follows:

 

<?php

include('Mail.php');

 

$recipients = '[email protected]';

 

$headers['From'] = '[email protected]';

$headers['To'] = '[email protected]';

$headers['Subject'] = 'Test message 1';

 

$body = 'Test message 1 with the body.';

 

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

 

// Create the mail object using the Mail::factory method

$mail_object =& Mail::factory('smtp', $params);

 

$mail_object->send($recipients, $headers, $body);

print "Sent Mail message to $recipients";

?>

 

How can we use the tags in the above working freeservers mail script to make mail work for oscommerce

 

Please give it a shot - its over my head

 

I need help bad with this one!

 

Thanks again everyone

Link to comment
Share on other sites

include_once('Mail.php');

//$headers = array();

$headers['From'] = STORE_OWNER_EMAIL_ADDRESS;
$headers['To'] = $to_addr;
$headers['Subject'] = $subject;

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

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);

$mail_object->send($to_addr, $headers, $this->output);

to replace (around lines 499-503 of includes/classes/email.php)

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

Note: if it doesn't work as written, try uncommenting (remove the //) the $headers = array(); line. I think that the header management may be basically incompatible with the way that osCommerce does it.

 

Further troubleshooting would involve a piece by piece switch with their original code. Essentially, we would want to try duplicating what they wrote and switching to the osCommerce variables one at a time to see which is the problem.

 

Make sure that linefeed in admin > Configuration > E-Mail Options is set to CRLF.

 

As this method involves replacing code, please backup the file first.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...