18 function mail($to, $subject,
$message, $additional_headers = null, $additional_parameters = null)
20 $GLOBALS[
'mail'][] = func_get_args();
35 $mailer =
new NativeMailerHandler(
'spammer@example.org',
'dear victim',
"receiver@example.org\r\nFrom: faked@attacker.org");
43 $mailer =
new NativeMailerHandler(
'spammer@example.org',
'dear victim',
'receiver@example.org');
44 $mailer->addHeader(
"Content-Type: text/html\r\nFrom: faked@attacker.org");
52 $mailer =
new NativeMailerHandler(
'spammer@example.org',
'dear victim',
'receiver@example.org');
53 $mailer->addHeader(
array(
"Content-Type: text/html\r\nFrom: faked@attacker.org"));
61 $mailer =
new NativeMailerHandler(
'spammer@example.org',
'dear victim',
'receiver@example.org');
62 $mailer->setContentType(
"text/html\r\nFrom: faked@attacker.org");
70 $mailer =
new NativeMailerHandler(
'spammer@example.org',
'dear victim',
'receiver@example.org');
71 $mailer->setEncoding(
"utf-8\r\nFrom: faked@attacker.org");
76 $to =
'spammer@example.org';
77 $subject =
'dear victim';
78 $from =
'receiver@example.org';
81 $mailer->handleBatch(
array());
84 $this->assertEmpty(
$GLOBALS[
'mail']);
88 $this->assertNotEmpty(
$GLOBALS[
'mail']);
89 $this->assertInternalType(
'array',
$GLOBALS[
'mail']);
90 $this->assertArrayHasKey(
'0',
$GLOBALS[
'mail']);
93 $this->assertSame($to,
$params[0]);
94 $this->assertSame($subject,
$params[1]);
95 $this->assertStringEndsWith(
" test.ERROR: Foo Bar Baz [] []\n",
$params[2]);
96 $this->assertSame(
"From: $from\r\nContent-type: text/plain; charset=utf-8\r\n",
$params[3]);
97 $this->assertSame(
'',
$params[4]);
102 $mailer =
new NativeMailerHandler(
'to@example.org',
'Alert: %level_name% %message%',
'from@example.org');
104 $this->assertNotEmpty(
$GLOBALS[
'mail']);
105 $this->assertInternalType(
'array',
$GLOBALS[
'mail']);
106 $this->assertArrayHasKey(
'0',
$GLOBALS[
'mail']);
108 $this->assertCount(5,
$params);
109 $this->assertSame(
'Alert: ERROR Foo Bar Baz',
$params[1]);
const ERROR
Runtime errors.
testConstructorHeaderInjection()
InvalidArgumentException
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
mail($to, $subject, $message, $additional_headers=null, $additional_parameters=null)
getRecord($level=Logger::WARNING, $message='test', $context=array())
NativeMailerHandler uses the mail() function to send the emails.
catch(Exception $e) $message
Create styles array
The data for the language used.
testSetterContentTypeInjection()
InvalidArgumentException
testSetterArrayHeaderInjection()
InvalidArgumentException
testSetterHeaderInjection()
InvalidArgumentException
testMessageSubjectFormatting()
testSetterEncodingInjection()
InvalidArgumentException