
Originally Posted by
ServerStorm
To further ralph.m's recommendations, If you do know a little php then
http://swiftmailer.org/ is a fantastic mail library for PHP. It allows you to do a number of advanced things, yet it has great documentation and can also be set to the most basic of needs.
Steve
this is my code this is the first time i use swift mailer but i find dificulty to use.
Code:
<?php
require_once './lib/swift_required.php';
function swiftmailer_configurator() {
// configure Swift Mailer
Swift_DependencyContainer::getInstance();
Swift_Preferences::getInstance();
}
Swift::init('swiftmailer_configurator');
Swift::init('swiftmailer_configurator');
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', 25)
->setUsername('root')
->setPassword('')
;
// Sendmail
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
//MAIL
$transport = Swift_MailTransport::newInstance();
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
// Create the message
$message = Swift_Message::newInstance()
// Give the message a subject
->setSubject('This is my subject')
// Set the From address with an associative array
->setFrom(array('mygmail@gmail.com' => 'John Doe'))
// Set the To addresses with an associative array
->setTo(array('tomyemail@yahoo.com' => 'A name'))
// Give it a body
->setBody('Here is the message itself testing....!')
;
// Send the message
$result = $mailer->send($message);
if($result==1)
echo 'successfully send';
else {
echo 'failed to send';
}
Bookmarks