0

I am getting 500 Internal Server Error while sending email using Zend Framework 1 and code I have mentioned below.

$transport = new Zend_Mail_Transport_Sendmail();
Zend_Loader::loadClass('Zend_Mail');
$mail = new Zend_Mail();
$mail->setFrom('someone@gmail.com', 'Name');
$mail->addTo('someother@gmail.com','Aaaaaa');
$mail->setSubject('Testing ');
$mail->setBodyText('Welcome');
$mail->send($transport);

And I am getting error while executing the on the line send method.

So please help me.

dineshsfdc
  • 11
  • 4
  • 3
    Please look into your error logs, so one doesn't have to guess what's happening. – Daniel W. May 08 '14 at 16:02
  • Are you developping in local on your computer with wamp or xampp? If so, you cannot send mail without configuring some module before. – Holt May 08 '14 at 16:03
  • @DanFromGermany In error logs, I am seeing HTTP:500 error – dineshsfdc May 08 '14 at 16:04
  • @Holt,I am working with xampp not on local it is on live server. – dineshsfdc May 08 '14 at 16:05
  • @DanFromGermany : This is what I am receiving 111.93.118.227 - - [07/May/2014:03:59:51 -0400] "POST /users/seekerforgot?keepThis=true& HTTP/1.1" 500 677 "http://jobsforbeauty.net/users/seekerforgot?keepThis=true&" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36" – dineshsfdc May 08 '14 at 16:11
  • 1
    @goggler that's the access log, we need the error log – Daniel W. May 08 '14 at 18:19
  • @DanFromGermany: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/sqlite.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0 – dineshsfdc May 10 '14 at 06:38
  • @goggler okay that error is clear now. You have enabled sqlite, but you don't have the module installed. Find in your php configuration files the module and disable it by commenting out that line. It might be useful if you delete this question and open a new one with this error and put your linux distro in the tags. – Daniel W. May 10 '14 at 11:02
  • @DanFromGermany:> I am getting this error Exim is a Mail Transfer Agent. It is normally called by Mail User Agents, not directly from a shell command line. Options and/or arguments control what it does when called. For a list of options, see the Exim documentation. – dineshsfdc May 12 '14 at 14:04

1 Answers1

0

Please do the following to get more informations about the error:

[...]

try {
    $mail->send($transport);
}
catch(Zend_Exception $e) {
    die($e->getMessage());
}

[...]

Please post it here...

There are many problems that can produce a 500 server error!

Sorry I have just seen your errors!

THIS IS WRONG SYNTAX!

$transport = new Zend_Mail_Transport_Sendmail();
Zend_Loader::loadClass('Zend_Mail');
$mail = new Zend_Mail();
$mail->setFrom('someone@gmail.com', 'Name');
$mail->addTo('someother@gmail.com','Aaaaaa');
$mail->setSubject('Testing ');
$mail->setBodyText('Welcome');
$mail->send($transport);

THIS IS CORRECT!

$transport = new Zend_Mail_Transport_Sendmail('no-reply@mydomain.com');

//you need to set the transport adapter via abstract method!
Zend_Mail::setDefaultTransport($transport);

$mail = new Zend_Mail();
$mail->setFrom('someone@gmail.com', 'Name');
$mail->addTo('someother@gmail.com','Aaaaaa');
$mail->setSubject('Testing ');
$mail->setBodyText('Welcome');
$mail->send(); //no parameters here!

More informations... http://framework.zend.com/manual/1.12/en/zend.mail.introduction.html

Scriptlabs
  • 498
  • 3
  • 16