Sending e-mail through sendmail
is usually a pretty standard way of working, as it is probably one of the most used ways of transporting e-mail (or proxying the e-mail to an SMTP server) on a Linux-based system. On most Linux servers sendmail
is already installed and therefore it's very easy to start sending e-mail with that.
That is why we will be discussing this method of sending e-mail first, so that we can start off easy.
In this recipe we will discuss the method of sending mail from within our application.
Let's take a look at the following example of sending an e-mail through sendmail
, and although this functionality is placed in a controller, in real life this needs to stay far away from that and be placed safely away in a model:
<?php namespace Application\Controller; // We need the following libraries at a minimum to // send an e-mail. use Zend\Mail\Message; use Zend\Mail\Transport\Sendmail; use Zend\Mvc\Controller\AbstractActionController...