Having issues with a rails 2.2.2 app running on a VPS (Ubuntu 8.10): looking for github repos, posts, anything that covers the right way of setting up email processing. For example, should it be using sendmail or smtp?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you looking to send or receive email (or both)?
The answers will be different in each case, and may (or may not) include configuring a mail server on the VPS.
If you need to configure a mail server the best guides (extensive and step by step) I found are those from slicehost that you find here: Mail server setup and configuration
If you need to just receive emails the best thing is to avoid installing a mail server and let your service provider (or Moogle) handle the incoming email.
Then you have to write some code to fetch those emails form the POP or IMAP server and feed them to the incoming mail handler (which typically is based on ActionMailer). One easy way to write the fetching code is to use the fetcher plug-in which incorporates the following common pattern of interaction with the mail server:
you need to create an instance of the class Fetcher passing the class of the object that will process the emails (plus any other configuration parameters that are needed), then calling the fetch method will execute the steps 1 to 4 above.
The plug-in is on Github: http://github.com/look/fetcher/tree/master and you can use it both to build a daemon (i.e. a process which stays in a loop polling the mail server for new messages), or to write a batch file to be run from cron (taken from the plug-in docs):