60 $mailConfigurationBackup =
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'];
61 $GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress'] = $fromAddress;
62 $GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName'] = $fromName;
63 $to =
'john@example.com';
64 $subject =
'Good news everybody!';
65 $messageBody =
'The hooks works!';
66 $additionalHeaders =
'Reply-to: jane@example.com';
67 $additionalParameters =
'-f postmaster@example.com';
69 $additionalHeadersExpected = $additionalHeaders;
70 if ($fromAddress !==
'' && $fromName !==
'') {
71 $additionalHeadersExpected .= LF . sprintf(
'From: "%s" <%s>', $fromName, $fromAddress);
73 $mockMailer = $this->getMock(
'TYPO3\\CMS\\Core\\Mail\\MailerAdapterInterface', array(
'mail'));
74 $mockClassName = get_class($mockMailer);
76 $mockMailer->expects($this->once())
78 ->with($to, $subject, $messageBody, $additionalHeadersExpected, $additionalParameters, $fakeThis)
79 ->will($this->returnValue(TRUE));
80 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/utility/class.t3lib_utility_mail.php'][
'substituteMailDelivery'] = array($mockClassName);
83 $GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'] = $mailConfigurationBackup;
99 $str =
'This text is not longer than 76 chars and therefore will not be broken.';
101 $this->assertEquals(1, count(explode($newlineChar, $returnString)));
110 $str =
'This text is longer than 50 chars and therefore will be broken.';
112 $this->assertEquals(2, count(explode($newlineChar, $returnString)));
122 $str =
'abcdefghijklmnopqrst uvwxyz 123456';
124 $this->assertEquals($returnString,
'abcdefghijklmnopqrst' . LF .
'uvwxyz' . LF .
'123456');
131 $str =
'Mein Link auf eine News (Link: http://zzzzzzzzzzzzz.xxxxxxxxx.de/index.php?id=10&tx_ttnews%5Btt_news%5D=1&cHash=66f5af320da29b7ae1cda49047ca7358)';
133 $this->assertEquals($returnString,
'Mein Link auf eine News (Link:' . LF .
'http://zzzzzzzzzzzzz.xxxxxxxxx.de/index.php?id=10&tx_ttnews%5Btt_news%5D=1&cHash=66f5af320da29b7ae1cda49047ca7358)');
143 'name <email>' => array(
'name <email@example.org>', array(
'email@example.org' =>
'name')),
144 '<email>' => array(
'<email@example.org>', array(
'email@example.org')),
145 '@localhost' => array(
'@localhost', array()),
146 '000@example.com' => array(
'000@example.com', array(
'000@example.com')),
147 'email' => array(
'email@example.org', array(
'email@example.org')),
148 'email1,email2' => array(
'email1@example.org,email2@example.com', array(
'email1@example.org',
'email2@example.com')),
149 'name <email>,email2' => array(
'name <email1@example.org>,email2@example.com', array(
'email1@example.org' =>
'name',
'email2@example.com')),
150 '"last, first" <name@example.org>' => array(
'"last, first" <email@example.org>', array(
'email@example.org' =>
'"last, first"')),
151 'email,name <email>,"last, first" <name@example.org>' => array(
152 'email1@example.org, name <email2@example.org>, "last, first" <email3@example.org>',
154 'email1@example.org',
155 'email2@example.org' =>
'name',
156 'email3@example.org' =>
'"last, first"' 167 $returnArray = \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses($source);
168 $this->assertEquals($addressList, $returnArray);
doMailCallsHook($fromAddress='', $fromName='')
static getSingletonInstances()
breakLinesForEmailBreaksTextIfCharWithIsExceeded()
static mail($to, $subject, $messageBody, $additionalHeaders=NULL, $additionalParameters=NULL)
static addInstance($className, $instance)
parseAddressesTest($source, $addressList)
breakLinesForEmailBreaksTextWithNoSpaceFoundBeforeLimit()
static breakLinesForEmail($str, $newlineChar=LF, $lineWidth=76)
static resetSingletonInstances(array $newSingletonInstances)
breakLinesForEmailReturnsEmptyStringIfEmptryStringIsGiven()
breakLinesForEmailBreaksTextIfLineIsLongerThanTheLineWidth()
mailCallsHookWithDefaultMailFrom()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
breakLinesForEmailReturnsOneLineIfCharWithIsNotExceeded()