Non-blocking SendMail...
Posted: Wed Nov 26, 2008 4:32 pm
Hello,
I'm currently working on a PHP web portal that has an 'invite a friend' / 'share with a friend' feature. We allow people to bring in contacts from outside services (google, msn, aol etc.) and then allow them to send an invite to these people.
We are using SWIFT right now with Code Igniter (CIgniter shouldn't affect it at all, I just mention for completness). We direct SWIFT to send via the GMAIL SMTP server.
The problem is that the Send process IS a blocking process. With 25 emails, the system can stall 20-45 seconds before moving to the next page, this is definitely not ideal for the impatient, click-happy web-user!
What I'd like to have happen, is for the emails to NOT BLOCK THE USER PROCESS.
I have been considering a proposal to (a) grab all the email address, (b) database them, (c) run a cronjob in the background that sends the emails BUT I want to make sure there isn't a simpler solution that can be achieved with SWIFT. Is there no way to have SWIFT submit the mails into some type of 'outgoing email queue' or to send using a non-blocking method?
I would also like to be able to send email from whatever FROM field I set. T'seems Google's SMTP server does not allow this (I can't make it look like the email is coming from the user who initiated the invite, it must be a gmail account or an account registered/known to gmail)
Apologies if I've mixed something up. I've have not done alot of work with bulk-email & this is my first use of the SWIFT lib.
Thanks in advance,
Ben
I'm currently working on a PHP web portal that has an 'invite a friend' / 'share with a friend' feature. We allow people to bring in contacts from outside services (google, msn, aol etc.) and then allow them to send an invite to these people.
We are using SWIFT right now with Code Igniter (CIgniter shouldn't affect it at all, I just mention for completness). We direct SWIFT to send via the GMAIL SMTP server.
The problem is that the Send process IS a blocking process. With 25 emails, the system can stall 20-45 seconds before moving to the next page, this is definitely not ideal for the impatient, click-happy web-user!
What I'd like to have happen, is for the emails to NOT BLOCK THE USER PROCESS.
I have been considering a proposal to (a) grab all the email address, (b) database them, (c) run a cronjob in the background that sends the emails BUT I want to make sure there isn't a simpler solution that can be achieved with SWIFT. Is there no way to have SWIFT submit the mails into some type of 'outgoing email queue' or to send using a non-blocking method?
I would also like to be able to send email from whatever FROM field I set. T'seems Google's SMTP server does not allow this (I can't make it look like the email is coming from the user who initiated the invite, it must be a gmail account or an account registered/known to gmail)
Apologies if I've mixed something up. I've have not done alot of work with bulk-email & this is my first use of the SWIFT lib.
Thanks in advance,
Ben