send email to a bunch of users class
<pre><code>class emailer
{
private $sender;
private $recipients;
private $subject;
private $body;
function __construct($sender)
{
$this-&gt;sender = $sender;
$this-&gt;recipients = array();
}
public function addRecipients($recipient)
{
array_push($this-&gt;recipients, $recipient);
}
public function setSubject($subject)
{
$this-&gt;subject = $subject;
}
public function setBody($body)
{
$this-&gt;body = $body;
}
public function sendEmail()
{
foreach ($this-&gt;recipients as $recipient)
{
$result = mail($recipient, $this-&gt;subject, $this-&gt;body,
"From: {$this-&gt;sender}\r\n");
if ($result) echo "Mail successfully sent to
{$recipient}&lt;br/&gt;";
}
}
}
</code></pre>

<p>why the code write this function?</p>

<pre><code>function __construct($sender)
    {
    $this-&gt;sender = $sender;
    $this-&gt;recipients = array();
    }
</code></pre>

<p>could i delete it? thank you.</p>
