The Contact Page: Sending the E-mail

The sending of the e-mail generated when the user submits a message via the contact page is handled by a class with a single method. This makes use of the Zend_Mail module to create and transmit the e-mail.

The class is implemented as follows:

class Default_Model_Mail_Contact
  public function send($bodyHtml)
    // Send the mail
    $mail = new Zend_Mail();
    $mail->setFrom('', 'Website'); 
    $mail->addTo('', 'Admin');
    $mail->setSubject('Re: Message submitted via website');

The send method creates a mail, which is sent to the account of the person who is responsible for handling enquiries. Most of the fields are fixed, except for the message body, which is generated in the action handler, then passed to the method.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s