How do I verify an email address is real and in use using the Sender Policy Framework - validation

From what I've been reading the SPF can be used to validate email addresses by sending commands (rather than an actual email) such as HELO. I've managed to pick up a basic grasp of the policy but I can't get my head around how I'd go about solving the following problem:
I've got a number of email addresses attached to contacts in a CRM system and I'd like to find out if the email addresses are valid and still in use.
Currently we're using a REST Web Service (http://emailinspector.co.uk/) which returns "Ok" (if its ok... duh), "Bad" (if its not valid or not in use) or "Unknown". For Unknown, you are also provided some notes on why it came back with that, i.e. you are told if the Mailbox is full or if its a well known DEA.
I'd like to be able to program a script that can replicate this functionality and from what I've worked out it should use the Sender Policy Framework to do this? The problem is I don't know how I'd go about returning such precise information for "Unknown" email addresses.
Ideas and thoughts?

Actually SPF is just a text record, with some "hints" to let you know if an IP address or mail server is "allowed/Authorized" to send email for that domain. It doesn't tell you anything about an individual email address in that domain..
for example
[doon#qix:~] host -t txt labratsoftware.com
labratsoftware.com descriptive text "v=spf1 a -all"
The SPF record for one of my domains says that only the a record for the domain is authorized to send email for labratsoftware.com, and that if it doesn't come from that IP then it should be rejected (-all).
So the best you can do with SPF is tell that a received email came from an authorized host, and then use that information to help decide if you want to reject it or not.
The best way To test the validity of an email address you have, is to email it, and see if it bounces. You can use options like VERP (http://en.wikipedia.org/wiki/Variable_envelope_return_path) to automate the bounce handling. You can also try and connect to the MX records listed for the domain and try to deliver a message that way. Some Mail servers support verify (But most admins disable this to prevent information leakage). You can use RCPT TO to see if the server accepts it, but even if it does , you have no way of knowing if it will actually make it to their INBOX. My guess is that is what the API you are currently using is doing. And unknown are just ones that either don't answer, greylist, etc.

Related

How can I replace the originating e-mail adress in Azure Api Management Service?

In Api Management Service, when someone subscribes to an Api, they gey a mail from a no-reply address. By default, this mail is something like "apim-noreply#mail.windowsazure.com", I changed this in de settings to "no-reply#myorganization.com".
But now when a user receives an email, both these addresses are listed as the sender address. How do I fix it to only display my custom address and remove the default one (circled in red)?
I tried looking in the mail templates to see if it was present there, but it wasn't.
I tried finding a solution in Microsoft documentation but couldn't find anything.
I understand that you wanted to change the "Mailfrom" header to a value of your choice. Currently it is not possible. The "MailFrom" header contains information about the actual sender of the email since APIM sends the mail you will not be able to remove apim-noreply#mail.windowsazure.com due to security issues.

Logic Apps Email Trigger - Get original Alias

Found a very similar question here: Email aliases not returned as "To" address in logic app
TLDR: From within a logic app "When a new email arrives" trigger, How do I get the original alias that the email was sent to?
I have a logic app that creates a ticket based off an email sent to an outlook box. Now I want to be able to choose aspects of the ticket based off of whether or not the email was sent to the mailbox itself or an alias of the mailbox. The problem I'm having is that by the time logic apps gets a hold of the email, the alias address has already been replaced with the actual box's address ("alias1#place.com" -> "actualbox#place.com").
The actual mail in the inbox has the original email's alias information in the headers, but I can only get them by looking at the properties in outlook. I've tried to get the original "To" internetheader information both within logic apps (by exporting the email to blob storage and looking at headers there) and with the Microsoft Graph API. Sadly, the email exported by logic apps doesn't have the alias information and Graph API has pretty much every header but "To". At least one other person has lamented the lack of To
That said, the actual email still has the original alias information. Can someone help me get that information in logic apps without jumping through too many hoops? A many hoop solution is welcome if none other can be found though.
Use the Export email (V2) action from the Office 365 Outlook connector. This will give you the full message with original headers (including the actual To address)!
The flow here is, trigger on the incoming email, as you already are, then add the export email action providing the message id from that trigger to pull this specific email.
From there, you you'll have one big "body" property which you'll need to interrogate to find the To address.
Caveat on this though, it doesn't work when emails are sent between mailboxes in the same Office 365 tenant. Exchange Online will "helpfully" go, "I know that address... this is the address you wanted!"
What API are you using? In Outlook Object Model / MAPI / EWS, you need to retrieve the PR_TRANSPORT_MESSAGE_HEADERS MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x007D001F)
We arrived at a many hoop solution.
The "Primary" email box now has some rules that look at the internet headers mentioned above (Message -> Properties -> look for 'To:').
If it finds an alias there, it will put the email in a corresponding folder for each alias.
Then we have logic apps listening to each of the alias folders which will then send the email's information to the _Core logic app that does the actual processing.

Issue when sending an email?

I did a lot of research through internet but I didn't found the solution. I'm trying to send a confirmation email using Mail::send() in laravel 5.1, I don't want to use any third party like mailgun or mandrill because they are not free sometimes limited of usage. The problem with this is all of the confirmation of the users is in their spam folder in gmail, and trash folder in outlook. Sometimes they didn't receive the confirmation. Why is that? Do you have any idea with this? My website is also registered to https so I don't think this is the problem.
.env
MAIL_DRIVER=smtp
MAIL_HOST=mail.mywebsite.com
MAIL_PORT=587
MAIL_USERNAME=email#mywebsite.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Landing of an email into Spam is nothing to do with Laravel.
Either you have to change the TXT record of your domain.
You can check it on mail-tester which values need to be changed.
https://www.mail-tester.com/
You might wanna try testing at Mail Tester. This can reveal a lot of information on why your emails are ending up in spam. I also recommend checking SPF and DKIM checking at SPF & DKIM checking at the same site.
Also are you hosting your emails with your hosting provider or some other third-parties like GSuite or Microsoft Exchange? These providers can influence the mail quality and spam checking greatly.
The spam classification of emails is to the discretion of the receiving mail server. There are a couple of best pratices to follow, when trying to avoid being marked as spam:
Make sure the sending server (smtp server) is allowed through
SPF
DKIM
DMARC
MX records
Further, the recipient server may check for bulk content with decentralized solutions like razor, pyzor or DCC. So, try to personalize the messages and not send bulk content. Its hard to evaluate your situation without specifics. Another problem may be the sending webserver if its in or from a country with "bad reputation" (like Russia, China). Since mail server also check the Original-IP of the email and potentially flag them as well.
SPF:
https://mxtoolbox.com/SPFRecordGenerator.aspx
DKIM:
https://dkimcore.org/tools/keys.html
DMARC:
https://mxtoolbox.com/DMARCRecordGenerator.aspx
To check your settings, it helps to use mail testing solutions visualizing those mentioned factors as mentioned by other answers.
Current email deliverability professional here. If you are willing to share the domain you are sending from, and the IP address initiating the sends I'm happy to check for any obvious problems.
I also heartily recommend mail-tester.com as I use it almost daily. If you want to share the link to the report I'm happy to help interpret.
The other thing to be aware of is, that IP addresses have a sender reputation that is tracked in the Email ecosystem at large. If it's a new sending IP address it has to get warmed up. Just like you cannot get a credit card with no limit as soon as you turn 21, Inbox Providers like Gmail and Hotmail are not just going to deliver everything a new sending IP starts trying to deliver to their recipients. They will essentially do some A/B testing by delivering some to the Inbox and some to the Spam/Promotions folder, and see how their recipients interact with your mailings. Gmail and thus other inbox providers are primarily concerned with how recipients interact with your mailings. Do they open, do they click links, do they add you to safe senders, etc.
-LB

Email deliverability check without sending an email or checking without SMTP

Here is the scenario. I am using PHP and I want to check whether an email address is valid and deliverable. Here are the steps I take:
Validate email address via regex
Validate email address via php filter_var
Finally use SMTP to check whether the recipient exists
This thing works perfectly except that using an SMTP way is too slow and takes anywhere between 10 seconds to 40 seconds to validate. Sometimes the SMTP check is blocked by the recipient server and my server ip was blacklisted which made all the emails to that server as invalid.
There are professional services out there which do this for you but I don't want to use them for this particular project I am doing. Due to restrictions I cannot actually send an email to that email address.
Is there anyother way or faster way to validate the email addresses? How do these professional email validating companies do the validations so fast and cheaply?
I apologise if the question is not right for this forum. Please tell me and I will promptly delete this. I am new to stackoverflow.
P.S: I checked the other questions but they all pointed to using SMTP as the solution which I am already doing.

Classic ASP e-mail verify that e-mail exists

Here's something I couldn't find an answer to. Say you have a form and on that form you have a field for someone to enter their e-mail address. Now after the e-mail address is entered, is there a way after using RegEx to verify that it follows the syntax of an e-mail address, to then verify that it is a valid e-mail that can receive messages?
I looked all over the net and found a deprecated way to do it that has since been stopped by patches, so I was wondering if there wasn't a way to do it on the server maybe polling the smtp server or something.
If you're looking to verify that the user hasn't made a mistake (or is giving you a bogus address because they aren't interested in your messages), you should probably do what every other system does: don't activate the account (or whatever) until you get some verification that the user has gotten the email by clicking a link or entering a code that the email contains.
You need to do this because you might never get an indication that an email address is invalid - some servers are configured to throw away some (or all) invalid email addresses or dump them in a spam bin. Just because the email appears to have been successfully sent doesn't mean it's valid or that it's getting to the right person.

Resources