With Attachment:
public function sendBodyEmail($mailto, $subject, $mailfrom,$from, $body)
{
try {
$mail = new Zend_Mail('UTF-8');
$mail->setType(Zend_Mime::MULTIPART_RELATED)
->addAttachment($this->_at)
->setSubject($subject)
->addTo($mailto)
->setFrom ( $mailfrom,$from )
->setBodyHtml($body);
$result = $mail->send ();
} catch ( Zend_Mail_Exception $e ) {
$e->getMessage ();
$result = false;
}
return $result;
}
No Attachment:
public static function sendBodyEmail($mailfrom,$from, $subject, $body,
$toemail, $toname)
{
try {
$mail = new Zend_Mail ('utf-8');
$mail->addTo ( $toemail, $toname)
->setFrom ( $mailfrom,$from )
->setSubject ( $subject )
->setBodyHtml ( $body );
$result = $mail->send ();
} catch ( Zend_Mail_Exception $e ) {
$e->getMessage ();
return $result;
}
return $result;
}
aplication.ini
;Mail
resources.mail.transport.type = "smtp"
resources.mail.transport.host = "smtp.googlemail.com"
resources.mail.transport.auth = "login"
resources.mail.transport.port = "465"
resources.mail.transport.ssl = "ssl"
resources.mail.transport.username = "email@gmail.com"
resources.mail.transport.password = "pass"
resources.mail.transport.register = "true"
resources.mail.defaultFrom.email = "email@gmail.com"
resources.mail.defaultFrom.name = "name"
resources.mail.defaultReplyTo.email = "email@gmail.com"
resources.mail.defaultReplyTo.name = "name"
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Email-tp3229929p3229973.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论