I am working with an extension in typo3 v6.2. In that extension i need to send emails to corresponding email address. Is normal
mail function can use to send emails from typo3 v6.2? Or is there any other method please let me know.
$to = $to_email;
$subject = $email_subject;
mail($to, $subject, $message);
Is this work in typo3 v6? Thanks in advance
Best How To :
TYPO3 has built in functions for sending e-mails and I would recommend to use the provided classes, since it includes all configuration setup (eg. SMTP auth, correct setting of e-mail headers) which could be configured in TYPO3 install tool.
Usage is quite easy and the example below is taken directly from the Core API documentation
$mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
$mail->setFrom(array($email => $name));
$mail->setTo(array($email => $name));
You should prefer this method over using PHP's mail yourself. The TYPO3 core's implementation (using the SwiftMailer class) implements mailing according to the specification and therefore sends the necessary headers and data to make it highly probable that the e-mail will arrive at most mail servers.