Zend Mail problem.

For programming and general questions on Zend Framework

Zend Mail problem.

Postby lukaszl446 on Fri Nov 02, 2012 5:30 pm

Hey,
I created new default project in ZF.

in index method I put:

Code: Select all
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('somebody[at]example[dot]com', 'Some Sender');
$mail->addTo('somebody_else[at]example[dot]com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send();


[at] and [dot] ofc means "@ "and "." (i cant put here links and emails)

and when I open a page I get error 500 Internal Server Error... but I have this email in my mailbox.

I tested this on ZF 1.10 and 1.12. ZF CE

Regards,
lukaszl446
lukaszl446
 
Posts: 2
Joined: Fri Nov 02, 2012 5:19 pm

Re: Zend Mail problem.

Postby kustome on Tue Nov 06, 2012 4:21 pm

Have you tried to add in a redirect?

$this->_redirect('/home');

or if you are looking to just stay on that current page after sending the email.. try $this->_redirect($this->view->url());
kustome
 
Posts: 4
Joined: Tue Nov 06, 2012 4:19 pm

Re: Zend Mail problem.

Postby facingwest on Wed Nov 07, 2012 2:58 pm

kustome wrote:Have you tried to add in a redirect?

$this->_redirect('/home');

or if you are looking to just stay on that current page after sending the email.. try $this->_redirect($this->view->url());



Wouldn't redirecting to itself just generate an infinite loop?

The process executes the $mail->send() otherwise you wouldn't have gotten the email, so i'm inclined to believe that the problem is elsewhere. Does this page have anything else in it? If you remove the Zend_Mail call completely does the error go away? Which method are you calling this from and as mentioned above what happens when you redirect to a different method within the same controller after sending the email?
facingwest
 
Posts: 18
Joined: Fri Sep 23, 2011 4:46 pm

Re: Zend Mail problem.

Postby lukaszl446 on Sat Dec 22, 2012 2:49 am

Does this page have anything else in it?


No, just default zf project.

If you remove the Zend_Mail call completely does the error go away?


Yes.

Which method are you calling this from and as mentioned above what happens when you redirect to a different method within the same controller after sending the email?


I put this send email code in "indexAction" method. I can't redirect to different method after sending email. Script stops after line $mail->send(); and I get 500 Internal Server Error (display_errors does not work in this case).
lukaszl446
 
Posts: 2
Joined: Fri Nov 02, 2012 5:19 pm

Re: Zend Mail problem.

Postby cone27 on Wed Jun 18, 2014 12:30 pm

I got the same!
any idea why??

Thanks, Rafal
cone27
 
Posts: 1
Joined: Fri Jan 13, 2012 12:58 pm

intelliteams

Postby inte3579 on Wed Jun 25, 2014 12:31 pm

HI,
I also facing the same problem :(

Any suggestion plz????

intelliteams. com
inte3579
 
Posts: 1
Joined: Wed Jun 25, 2014 12:27 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 10 guests