blakcaps
blakcaps

Reputation: 2647

Zend Framework Send Mail

Is it possible to send array values as body of the zend mail.For example,

$mail=new Zend_Mail();
$params=$this->getRequest()->getParams();
$mail->setSubject('Order products');
$mail->addTo('[email protected]','Recipient');
$mail->setBodyText($params['products']); // $params['products'] array
$mail->setFrom('[email protected]','Name');

But this doesn't seem to work.

Upvotes: 0

Views: 549

Answers (3)

Nikhil_K_R
Nikhil_K_R

Reputation: 2373

$mail = new Zend_Mail('utf-8');
$mail->setBodyHtml($message)
->setFrom('[email protected]', 'abc')
->addTo($to, 'admin')
->setSubject($subj);

Here $message contains all table contents retrieved from Post.
Suggestion given by @Pekka is an important one.
Hope this helps you.

Upvotes: 0

user1921361
user1921361

Reputation: 23

i used this way and it worked for me..

$mail = new Zend_Mail();
$mail->setFrom('[email protected]');
$mail->setBodyHtml($oForm->getValue('text'));
$mail->addTo(array('[email protected]', '[email protected]'));
$mail->setSubject('support mail');

Upvotes: 0

Nemlaghi.bechir
Nemlaghi.bechir

Reputation: 131

You will have always an empty body this way, you need to convert your array into String

The BodyText is an object(Zend_Mime_Part), along with other information this object contains a content field, the problem is : befor adding the content to the mime_part object it passes throu rtrim(), so as result you will have an empty string passed as content.

rtrim() expects parameter 1 to be string, ....\library\Zend\Mime.php on line 170

Upvotes: 1

Related Questions