I am using swift on my website.
I think I have been setting it up correctly yet my emails end up in the spam box of the receivers each time (yahoo, hotmail...)
can someone help me out please?
i have activated the reverse dns, I have a spf record, I am using both html and text in the email.
this is an example
Code: Select all
//email here
require_once "../includes/mailer/Swift.php";
require_once "../includes/mailer/Swift/Connection/SMTP.php";
require_once "../includes/mailer/Swift/Authenticator/LOGIN.php";
require_once "../includes/mailer/Swift/Plugin/Decorator.php";
//Start Swift
$smtp = new Swift_Connection_SMTP("smtp.mydomain.com");
$smtp->attachAuthenticator(new Swift_Authenticator_LOGIN());
$smtp->setUsername("mylogin");
$smtp->setPassword("mypassword");
$swift = new Swift($smtp);
$message = new Swift_Message("{fname} {lname} has sent you a gift!");
//Create the message
$message->attach(new Swift_Message_Part("Plain text here"));
$message->attach(new Swift_Message_Part("HTML Part, using hte Decorator", "text/html"));
$replacements = array(
"$email1" => array("{fname}" => "$fname", "{lname}" => "$lname", "{password}" => "$password_temp1"),
"$email2" => array("{fname}" => "$fname", "{lname}" => "$lname", "{password}" => "$password_temp2"),
"$email3" => array("{fname}" => "$fname", "{lname}" => "$lname", "{password}" => "$password_temp3"),
"$email4" => array("{fname}" => "$fname", "{lname}" => "$lname", "{password}" => "$password_temp4"),
"$email5" => array("{fname}" => "$fname", "{lname}" => "$lname", "{password}" => "$password_temp5")
);
//Load the plugin with these replacements
$swift->attachPlugin(new Swift_Plugin_Decorator($replacements), "decorator");
//store emails in an array, loop the array (prevents a problem: when one email is empty => error and header is not sent...)
//works: $array = array("$sendmail1"=>array("$email1"));
$array = array(
array("$sendmail1", "$email1"),
array("$sendmail2", "$email2"),
array("$sendmail3", "$email3"),
array("$sendmail4", "$email4"),
array("$sendmail5", "$email5")
);
foreach($array as $key=>$value)
{
if(!empty($value[0]))
{
$swift->send($message, "$value[1]", "webmaster@mydomain.com");
print_r($value[1]);
}
}
$swift->disconnect();
hope someone here can help.
Thanks!
Alex