Hi,
I’m developing a social network, and now i want to let users to import their address book (using openinviter) and send invitations to join my site. (using swiftmailer to send mails)
The biggest issue I’m facing now is this. My server (hostgator) only allows 500 mails per hour, plus even though i manage to send those mails, most of them end up in junk list (ex. hotmail, yahoo accounts)
Create a table in your database, then store a list of the email addresses you wish to send to. Then, create a cron job to run every 30 minutes to work it’s way through the list of emails, marking them as sent as it goes.
<?php
#get 200 email addresses that we have not sent to yet
$result = mysql_query(
'SELECT id, email FROM email_queue WHERE sent = false LIMIT 200'
);
$sent = array();
while($user = mysql_fetch_assoc($result)){
#send email
if(true === mail($user['email'], 'Subject', 'Message')){
#mark it as sent
array_push($sent, $user['email']);
}
}
#update database
mysql_query(
sprintf(
'UPDATE email_queue SET sent = true WHERE id IN (%s)',
implode(',', $sent)
)
);
?>
Same concept I used for montly newslettesr… then a day before the next batch goes I havea cron job that updates sent field to false ready for the next monthly batch to mail out and get marked as true.
rather than being worried about using code…
One main concern here i guess is…
how to eventually not end in junk/spam folder…
or at worst …avoid ip block…
yahoo esp seems to be too strict and now every shared hosting is adopting strict measures against it…
so be careful before implemeting it…
Hi
thank you all for replying. Even if i manage to send those emails I should assure that all messages are delivered right into inbox avoiding spam.
What measures I should take in this case?
Are there any SMTP providers that handle message delivery? Do they allow unlimited message delivery per month?(as the number of invitations sent by a user may vary)
yup,but later one changing contents of email after first 20 is easier said than done…
normally it is same newsletter that need to be sent to all customers…
may be he can introduced some dyanmic variable there…
but i have found most of the modern email server are able to detect that…
but good news is most of the modern smtp server are avle to find a way out…may be using proper time outs and all…
I have success in sending out 1000+ emails once a month via my webhost with out spam issue (altho they can also be marked as spam by the email client in which you have no real control over) Its mostly about getting your headers correct I beleave. Nnone of my emails are marked as spam by hotmail, gmail, yahoo etc…
Agreed, most email problems are on the client end. If you can’t get your mail server to pass through emails, that’s certainly a problem, but I assure you… your pass through rate on the destination mail servers is even lower. Clients can, and will, mark your emails as spam (even for opt-in lists), which can get you into trouble. This also means changing up your headers and content is not all that relevant unless it’s your own mail server is squashing you.
is it shared server?
it depends upon the other site in that server as well
and lot of web host as well,some keep on chaning their email server ip and all…
So,i thin generalizing and coming to conclusion “may be sending 100 emails per hour is allowed” may not be true…
yup 1000 email in month infact less for most webhost,but it depends on nature or message,timing and all…
lots of factors there as well.
Spam is not marked by email client,for eg if hotmail or yahoo send your emails to spam or junk,the client has nothing to do with it…now its your duty to think how to bring it to normal inbox
but i also agree,these are normally has to take more with hosting more than programming.(if we donot use email() wildly)
here as well,i feel its newsletter sender’s duty to ensure that newletter end up in right folder ie. inbox…the duty of the programmer or webmaster doesnt just end after getting
if(email(…))
{
…}
getting true from there…
otherwise,people wont bother buying smtp servers or account just to send emails…