I am working on a windows service that reads the inbox, archives the emails, couples the email to a ticket and put it in the database.
My problem is that we check the internetmessageheaders to see if an email is auto-submitted. But now we get an error message logged to the database every 5 seconds because the internet message headers is null.
for context the inbox is empty and it has worked before.
I did some testing and it worked fine except for 1 email i got in my test mail. It has the email headers that looks like the headers of a sent email and just like a sent email i can't get the internetmessageheaders.
Now i am left wondering if i can get the internetmessageheaders from that email or if i have to build a workaround because internetmessageheaders aren't supposed to be null on an received email
Related
I have a web app that sends emails via smtp on behalf of the user to their customers. I am able to put the user's email in the reply-to of the email and this works for normal email use for the users. In the case the recipient has an auto-responder or the email entered was incorrect email, the auto replies go to the sender not the reply-to. The sender inbox is unmonitored.
The sender email service is using and Office365 account.
What are my options to get the auto replies and returned emails to the reply-to email?
This may be because the autoresponders don't regard their messages as replies, but rather as messages from the email system itself.
Your mail has three or four addresses related to the sender, which generally show up at the recipient as Return-Path, Sender, From and Reply-To. Return-Path is who should get error messages and other messages from the email system itself, Sender and From are the address that should be displayed as having sent the mail and Reply-To is the address to which the addressee's replies should be directed. (Sender and From are only very rarely different these days, but historically Sender might be e.g. a particular member of a team while From is the team's shared address.)
Many autoresponders respond to the address that shows up as Return-Path in the final message (it's also called the envelope from address), so your options are:
use the user's address as envelope from
set up a forwarding scheme so that autoresponses are suitably forwarded
The first is very tricky wrt. DKIM, DMARC etc, so you'll probably find the second one simpler, even though it requires you to filter spam and perhaps more.
Is there any mechanism in which you can prevent a user from replying to an email message? Here's the use case:
An automated system (C#.net) sends emails to a user. The action of the task
is included in the email message (e.g. RSVP link for "yes" or "no")
Instead of using the buttons/actions in the email, the user replies
to the email.
The email originally sent specifically says that the mailbox in use
is unmonitored. (in bright red box!!!)
The user doesn't actually read the email, and gets pissed off when nobody replies or his RSVP is "lost"
Clearly a user issue. I'm thinking the best recourse might be an automated reply saying the mailbox is unmonitored if a user replies to the e-mail.
Any SMTP conditions/flag which can prevent a user from replying in the first place?
I don't believe there is any setting that you can include in the original email that would stop someone from replying to an email.
If the recipient really wants to reply, they can literally copy-paste the sender's email address into a new email and reply to it that way.
Just wanted to point out that the following hack is not elegant and would result in a bad customer experience. This is the only way I could think of achieving this.
One hack that comes to my mind is that you can try to set MailMessage.ReplyToList property to an invalid email address like - abc#g#g.com. In theory, this will force the customer's email client to reply to the invalid email address instead of the original sender. We can hope that the customer's email client validates that before sending the reply.
I have not tried this myself as I don't have an SMTP server to validate. But if the SMTP server does not validate the ReplyToList value then it should work.
Again this is a super sketchy hack and might not work with all the email clients out there.
You are better off setting up an auto-reply on the mailbox.
In our application, we are using Common From Email address to send an email to all the users.
To receive the reply back from the users, we use Reply to Header and we want users to send an email to 2 different users hence we use 2 email addresses in reply-to header.
When we reply to the email from Outlook, it works fine but in GMAIL, emails are going to Common From email address instead of Reply-To Email address.
When I use single email address in the REPLY-To header, functionality works fine. Issue is only when we use 2 email address in reply-to header.
mailMessage.ReplyToList.Add(New MailAddress("1stReplyTo#domain.com"))
mailMessage.ReplyToList.Add(New MailAddress("2ndReplyTo#domain.com"))
mailMessage.From = New MailAddress("commonEmailAddress#domain.com")
mailMessage.Body = "body"
mailMessage.Subject = "subject"
We were using this feature from last few years. But in a recent time we started facing this issue.
I am using System.Net.Mail/ SmtpClient to send verification Email in MVC4. The primary email address format check is performed by a REGEX. I am successful in sending messages using Gmail SMTP server.
However I would like to know if the email address that I am sending message to Exists and that my email is received as the user will not be approved without verification link. I tried non existent email address and no warning/exception was generated.
Can anyone point out any method to generate exception if the sending fails due to non-existence of the email address. Or can you suggest what status codes to look out for?
I'd like to be able to log a unique id from an email with a delivery receipt in a database that i can then use to link the delivery receipt email when it comes back from the recipient. I tried using the Thread-Index Internet Message Header, but I don't have access to the message headers when I initially send the email.
Is it possibe to
1. create an email.
2. add a delivery receipt
3. use a unique id from that email and store it in a database
4. search for that unique id in the delivery receipt message when it arrives.