function testVerpEnvelopeSenderCanCreateStandardSender() { $sender = twfy_verp_envelope_sender('*****@*****.**'); $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); }
function send_email($to, $subject, $message, $bulk = false, $from = '', $want_bounces = false) { // Use this rather than PHP's mail() direct, so we can make alterations // easily to all the emails we send out from the site. // eg, we might want to add a .sig to everything here... if (!$from) { $from = CONTACTEMAIL; } $headers = "From: TheyWorkForYou <{$from}>\r\n" . "Content-Type: text/plain; charset=iso-8859-1\r\n" . "MIME-Version: 1.0\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . ($bulk ? "Precedence: bulk\r\n" : "") . "X-Mailer: PHP/" . phpversion(); twfy_debug('EMAIL', "Sending email to {$to} with subject of '{$subject}'"); if ($want_bounces) { $envelope_sender = twfy_verp_envelope_sender($to); $success = mail($to, $subject, $message, $headers, '-f ' . $envelope_sender); } else { $success = mail($to, $subject, $message, $headers); } return $success; }