I am building a tool for users to send invites for a site. Is ActionMailer the best way to send the mail? It seems to be very very slow.
Anyone have other recommendations?
(Ubuntu Intrepid Server)
Thanks.
I am building a tool for users to send invites for a site. Is ActionMailer the best way to send the mail? It seems to be very very slow.
Anyone have other recommendations?
(Ubuntu Intrepid Server)
Thanks.
Action mailer is slow for you because it is sending synchronously, waiting for google to go through the whole mail sending protocol. You can see this in detail in your log. The request doesn't finish until the mail sending does.
You have a couple options to speed this up:
use asynchronous sending. This can be from a tool like background job/delayed job, and I'd recommend that to start. There may even be a lighter weight solution. If that doesn't hack it, starling and workling provide more robust queues for this.
attach to a local mail sender. You can set up a local smtp server, or use the send_mail configuration option.
If you're serious about sending mail you should probably have your own mail server, i personally use http://www.rackspacecloud.com/cloud_hosting_products/servers and you can follow directions http://cloudservers.mosso.com/index.php/Postfix_-_Installation (ubuntu hardy) and get your own postfix MTA up and running (easier said than done). I agree with ndp about the asynchronous sending, but if you're sending alot of email, gmail caps you to a maximum number of messages per day. This is the method that I use, and sending takes miliseconds, even when sending from other servers.