Has anyone seen any examples of how to run an smtp server with Rails hosted on heroku?
I'm interested to send mail to my own smtp server, manipulate the content with rails by adding a footer, adding link tracking etc, then send it out again.
Once I have the data, easy. Not sure where to begin in terms of setting up smtp.
Alternatively, are there any smtp services out there that will simply POST the data to my app?
Take a look at SendGrid here http://sendgrid.com/
They've got some great APIs, and should be able to enable what you want.
If you want inbound email via a post to your application look at cloudmailin.com
It's python, not RoR, but the Lamson project is pretty close to what you are talking about.
http://lamsonproject.org/
(Thanks Zed!)
Related
I have a Rails app running on Heroku that uses Mailgun to process incoming emails. I haven't been able to figure how I can debug my email processing locally (on localhost) instead of having to push everything up to heroku every time I make a change. (this is just a test app - I'm the only one using it)
Is it possible to work with Mailgun locally? If so, how do I go about it?
Thank you in advance
Mailgun gives you the option to store a message for later retrieval. If you configure it that way, you'll be able to fetch messages from development for processing without having to set up a publicly-accessible webhook for Mailgun to hit.
But I'm assuming you have production configured with an HTTP endpoint, and it's no fun to do things differently between environments. There are a few tools that will let you set up a public endpoint that routes to localhost:
ngrok, which I've used to good effect to test Twilio. You can set up a permanent subdomain so you don't have to constantly change your Mailgun configuration.
UltraHook, which I haven't personally used, but looks the same.
Localtunnel which looks easiest to start up, but like you get a different host at every boot.
If you have a permanent publicly-accessible server, you can also maintain your own tunnel.
mailgun provides a sandbox that you can use for localhost the only downside to this is that you have to add the test email to valid recipient.
using this gem might be another possible solution:
https://github.com/ryanb/letter_opener/ or https://github.com/fgrehm/letter_opener_web for more advanced features
follow installation from repo
mail will open in new tab
I am newbie on ruby on rails and gems...If any one help me to figure out that any gems or script that downloads all the emails from gmail to my local machine
I heard about ruby 'net/imap'
but using it I am not able to fetch or authenticate
imap = Net::IMAP.new('mail.google.com')
imap.authenticate('LOGIN', 'bmonal125', 'aaaa')
Please suggest me ...
I need any kind of technical suggestion to overcome it
Thanks in advance
Have a look at http://rubydoc.info/gems/gmail, there are detailed examples on how to authenticate and retrieve messages.
If the authentication does not work, it is quite possible that your IMAP access is not configured in gmail. Have a look at support.google.com/mail/troubleshooter/1668960?hl=en#ts=1665018 on how to enable it
I use sendmail to send emails from my application. I always send the emails from SOME_NAME#MY_DOMAIN.com but they always endup in spam folder.
I know that I should do some stuff on the DNS side to make my emails be marked as non-spam, but I don't know what they are.
I am a newbie and this is my first time setting up a production server, a domain and everything else myself. I appreciate if someone helps me.
What sort of environment are you deploying to?
This frequently happens to applications deployed to cloud services, like Amazon or RackSpace. Their entire IP blocks are registered as spam at services like Spamhaus, which is a sensible precaution or else we'd be getting even more spam than usual. You should enter your server's IP address in that field to see if you're listed as a spammer.
If you are, you can request to Spamhaus that the block be lifted. Getting in touch with Amazon's support stuff also helps. Finally, you can get around the issue entirely by using a sendmail service of some sort -- Amazon SES is pretty good, and there's even a Gem out there that provides integration to Rails apps.
In one of my Rails applications I'm sending emails through the Gmail SMTP server and everything just works, mails are not going to spam and so on ... But there's one thing that concerns me, the 500messages/day limit the SMTP has, currently I'm over 350/day. I didn't find any official Google page where they talk about the subject, just blog posts that seems to be reliable. Then my question is what do you suggest me in order to be able to send more than 500messages/day? I would love to keep using the Gmail SMTP.
Any help would be appreciated.
Don't use GMail for what it wasn't built for. It wasn't designed as a mass-email system, although Google definitely has the firepower to do this.
Instead, perhaps use something like SendGrid to send your emails. SendGrid is designed for this and is just as easy (actually, probably easier) to set up with than GMail.
You can consider using more than one gmail account to access the smtp server, however you may have problems with ip limits (couldn't find anything on their docs about it). Another option is performing dns mx lookups yourself and reproducing your own smtp server by directly delivering the messages to the user's emails - but that can increase the odds of you being tagged as a spammer as your ip is not whitelisted as sender.
I think the best way is to create another gmail account and trying to reroute your connection to use it when one of the accounts reaches the daily limit. A vpn connection can solve that for you.
I'm developing rails on localhost and wondering what is the simplest way, in terms of workflow, of building email functionality in.
So I figure:
Get mail working on localhost.
Then when I deploy on a production server just change the smtp settings.
Is this a reasonable approach? Can you actually send email from localhost? Know of any tutorials on email in rails?
E-mail/SMTP should work fine from any host connected to the internet with access to a DNS server.
I don't see anything wrong with your approach.
agree. Using SMTP is a quick and easy way to get mail up and running on your localhost dev box.