when should be choose simple php mail and when smpt with loggin+password?
- by user43353
Hi,
My Case:
web application that need to send 1,000 messages per day to main gmail account.
(Only need to send email, not need receive emails - email client)
1. option - use php mail function + sendmail + config php.ini
php example:
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
php.ini config (ubuntu):
sendmail_path = /usr/sbin/sendmail -t -i
pros:don't need email account, easy to setup
cons:?
2. option - use Zend_Mail + transport on smpt+ password auto
php example(need include Zend_Mail classes):
$config = array('auth' => 'login',
'username' => 'myusername',
'password' => 'password');
$transport = new Zend_Mail_Transport_Smtp('mail.server.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('[email protected]', 'Some Sender');
$mail->addTo('[email protected]', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);
pros:?
cons:?
Questions:
Can 1 option be filtered by gmail email server as spam?
please can you add pros + cons to options above
Thanks