For context: I already have a regex for format validation and MX check, and would like to add a layer of SMTP validation. I have tried 2 gems: email_verifier and Truemail, none of which seem to perform well. For example, Truemail gem: tested on 1081 valid emails (verified by sending a link and have the users click), 171 came out invalid => ~15% fail rate for various reasons: the mail server blocks SMTP call resulting in an error code, timeout (when I already configured the timeout limit to be 10s), some emails need to be verified twice to return true, etc.
I was wondering if there's a way to appropriately do emails SMTP validation in RoR, or should I resolve to other paid services (Snov , Truemail , etc) ?
It is likely that trying to connect directly to the smtp servers of the destination email domains from your Rails web server resulted in those servers rejecting your connection attempt as spam.
How were the 1081 valid emails sent originally? Most web applications don't send email directly from the Rails application server connecting to an SMTP server, but rather relaying through an SMTP relay or service such as AWS SES, Sendgrid, Mailchimp, etc. Those services would be configured better with correct SPF and DKIM DNS records for the IP addresses sending on behalf of the origin address and also likely have better reputations for the IP addresses they are originating from.
Related
Many similar questions have been asked here, but most have the issue of port 25 being blocked by a cloud provider (i.e. DigitalOcean) or the ISP (i.e. Xfinity). I have neither of these problems, but still can't send outgoing mail.
I try to send outgoing mail, but get this error from posfix/smtp
connect to alt2.gmail-smtp-in.l.google.com[142.250.152.27]:25: Connection timed out
I am running a postfix from a spare laptop that is running Ubuntu Server, so I know it isn't a problem with a cloud provider. Additionally, I have Google Fiber, and they do not block any ports, including port 25. Just as a test, when I telnet to the above address, I can successfully connect.
$ telnet alt2.gmail-smtp-in.l.google.com 25
Trying 2607:f8b0:4001:c56::1a...
Connected to alt2.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP x17si5369573iow.10 - gsmtp
Any ideas what the final blocker is? The one thing I can think of is my postfix main.cf variables below might need tweaking. Also, FYI I am running the postfix server in a Docker container.
mydestination = localhost.$mydomain, localhost
proxy_interfaces = X.X.X.X # Static IP of Google Fiber router that is externally facing to WAN
After some digging, I looked up my hostname on Realtime Blackhole Lists, or RBLs, and discovered that my hostname and therefore mail server were being rejected as spam by any mail server that checks the public RBLs.
The solution to this was to set up SPF, DKIM, and DMARC through my DNS provider. Each of these play a role in reducing hostname spoofing, spam email, and other malicious activites. There are many tutorials online on how to do this.
SPF is Sender Policy Framework. This is used to prevent others from spoofing your domain.
DKIM is DomainKeys Identified Mail. This allows the senders to authenticate their emails by including a digital signature in the email header. DKIM uses public-key cryptography to verify that an email message was sent from an authorized mail server.
DMARC is Domain-based Message Authentication Reporting & Conformance, which builds on SPF and DKIM to prevent domain spoofing.
I am looking for a way to test the email sending feature of our app. I have configured namshi/smtp docker image to act as an smtp server and our app is using this smtp server to send emails. We currently have a system that reads the email on the client side once its delivered, to verify we are formatting the email correctly. This is a bit unreliable since it involves an actual email being delivered.
So, I wanted to see if there is a way to intercept or read emails being delivered through this local smtp server. I checked the logs of the smtp server but as expected, it doesn't have any details of the email body or subject. Anyone knows anyway I could intercept these smtp requests somehow?
Or if there is a better way to verify email formatting as part of integration testing?
Heres a good source on how to use smtpd library in python to mock an SMTP server https://pymotw.com/2/smtpd/. Mock SMTP server and process emails through smtpd.SMTPServer.process_message
I have acquired the domain name - xyz.in from GoDaddy.com and also acquired the mail ID - info#xyz.in. And currently, I can able to send 500 mails by using GoDaddy.
So, I'm thinking to implement my Mail Server using Delphi - TIdSmtpServer. I found few samples but for sending mails how can I use the sender ID as info#xyz.in and send mails. As I need to send only mails, what are the other settings and please provide some basic sample code.
Thanks in advance.
SMTP is one-way, from sender to receiver. You cannot send emails with TIdSMTPServer, only receive them. Your SMTP server needs to store received emails as needed for you to retrieve them later, via POP3/IMAP, or whatever custom system you want to make.
When someone wants to send an email to you at info#xyz.in, they perform a DNS lookup of the MX record for xyz.in, then connect to that server and issue SMTP commands to deliver the email to the info mailbox 1. So you need to configure your domain's DNS MX record to point at the IP address of your SMTP server machine.
To send an email from your system to someone else, use TIdSMTP instead, so it can connect to and send the email to the other person's SMTP server. You can use TIdDNSResolver to lookup a domain's MX records to find the IP address(es) to connect to 1.
1: most users send an outgoing email through their ISP's own SMTP server and let it relay the email to each recipient's domain SMTP server as needed. And use their ISP's SMTP server to receive emails. This is easier for users to use and configure, and it is safer as it allows ISPs to implement security and anti-spam measures. So you may end up sticking with GoDaddy's SMTP server instead of running your own in the long run.
I want to send mails using specific smtp credentials (those of a Gmail account) from my rails app.
The problem I encounter is that the IP specified in the resulting email is likely to be blacklisted (actually, as I'm using Heroku, it is blacklisted).
Does anybody know a way to send from a whitelisted IP / rewrite this IP, while still using those SMTP credentials?
I tried to use things like Proximo but it doesn't seem to support SMTP...
Thanks,
I'm working on an iOS app through which user can read and send messages from his email account.
My question is that once user is logged in into IMAP server for reading mails, he has to login separately into SMTP server for sending mail? or the question can be vice versa, once he is logged in into SMTP server he have to login separately into IMAP server for reading email.
I'm not entirely sure what your question is, but yes. For IMAP/SMTP, the incoming and outgoing components are completely separate protocols, and don't even have to be on the same server (and often aren't: see imap.gmail.com and smtp.gmail.com), so yes, they need to be logged in to separately. Usually, they're the same username and password, but that's not even always true.