I just discovered swiftmailer a couple of weeks ago, and I have to say its some very nice work! I have already made a little donation to the author
I am able to send my emails without any problems, but on the server that I am currently testing it, I have a limit of sending 100 emails/hour. I don't know if it has anything to do with number of connections or not. Their wiki only says that you are allowed to send 100 emails per hour.
My idea is to use swiftmailer to send emails to my customer base (about 800 emails) currently stored in my database. To achieve this I just need to use the AntiFlood plugin?
When Ii move this into production, to my dedicated server, I guess I won't have this problem.
No problem. Hope you enjoy your time "down under with the aussies !"
I will try out the Throttler plugin. Can you give me your opinion on my sending procedure? This is my first shot at it.
Here is a snippet of the code that does my mailing:
require_once "../tools/Swift-3.1.2-php5/lib/Swift.php";
require_once "../tools/Swift-3.1.2-php5/lib/Swift/Connection/SMTP.php";
//Start Swift
$smtp =& new Swift_Connection_SMTP("mail.myserver.com", 587);
$smtp->setUsername("mylogin");
$smtp->setpassword("mypw");
$swift =& new Swift($smtp);
$result = mysql_query("SELECT recipient_email FROM common_recipients WHERE list_id=$list_id");
// build email message
$html_body = "<strong> message here </strong>";
$text_body = "message here";
//Create the message
$message =& new Swift_Message(urldecode($message_subject));
//Add some "parts"
$message->attach(new Swift_Message_Part($html_body, "text/html"));
$message->attach(new Swift_Message_Part($text_body, "text/plain"));
while ($row = mysql_fetch_array ($result)){
//Now check if Swift actually sends it
if ($swift->send($message, urldecode($row['recipient_email']), urldecode($message_from_email))) echo "Sent";
else echo "Failed";
}
Remember $message has various accessors and mutators such as setBody(), setSubject() etc. If you create $part as a separate object then attach() that object you can also adjust the values in $part in just the same way.
The Decorator plugin may be of interest if the messages are customized for each recipient
That Decorator plugin looks very good. I'll try to use that.
In my messages, the only thing that will change is a link at the bottom to allow the users to unsubscribe. In this link I include the userid which is another database field, so I can use the attach() to just change that line at the bottom of each email. I believe!