Dot_Email class extends Zend_Mail, so all the methods from Zend_Mail are available  in Dot_Email.

Dot_Email is a simple class composed only from 2 methods, except constructor, all  other methods beeing inherited  from Zend_Mail.

1.   setContent() , as the name is suggesting, set the body of the email by calling setBodyText() (if format is “text/plain”) or setBodyHtml() (if format is “text/html”).

Note the declaration of this method: setContent ($content, $format = ‘text/plain’)

2.  send(), set the transporter and is calling parent::send() method for sending the email

For sending the email you MUST use this methods in the code above:

$dotEmail = new Dot_Email();
$dotEmail->addTo($email);
$dotEmail->setSubject('Forgot Password');
$dotEmail->setBodyText('Your password is '.$password);
$succeed = $dotEmail->send();
if($succeed)
{
	echo "Message sent!";
}
else
{
	echo "Message failed, not sent!";
}

Only if you want to overwrite the default Email and Name, add the below lines:

$dotEmail->setFrom($fromEmail, $fromName);
$dotEmail->setReplyTo($fromEmail, $fromName);

NOTE*: you always have to use  addTo()setSubject(), setBodyText() or setBodyHtml() or setContent(), and finally send() method.

Methods inherited  from Zend_Mail and that can be used in your code are:

  1. setBodyText($txt,$charset=null,$encoding=Zend_Mime::ENCODING_QUOTEDPRINTABLE)
  2. setBodyHtml($html,$charset=null,$encoding=Zend_Mime::ENCODING_QUOTEDPRINTABLE)
  3. addTo($email, $name=”)
  4. addCc($email, $name=”)
  5. addBcc($email)
  6. setFrom($email, $name = null)
  7. setReplyTo($email, $name = null)
  8. setReturnPath($email)
  9. setSubject($subject)
  10. addHeader($name, $value, $append = false)

Looking for PHP, Laminas or Mezzio Support?

As part of the Laminas Commercial Vendor Program, Apidemia offers expert technical support and services for:

  • Modernising Legacy Applications
  • Migration from any version of Zend Framework to Laminas
  • Migration from legacy Laminas API Tools (formerly Apigility) to Dotkernel API
  • Mezzio and Laminas Consulting and Technical Audit
  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>