Problem steps :
My company sends mail to external partners (using .Net SmtpClient),
Some of them have set up "transparent forwarding" on our mails to some of their co-workers,
Those co-workers receive our mails as if we have send them directly to them (no "on behalf of", no classical "forward" from the original "To" mailbox), without any clue of which mail box has transparently forwarded them the mail.
(In fact, smtp conversation traces in the mail properties allows to find it, but most users are not tech savvy enough to be able to access such information, and we have not the knowledge for explaining them how to do for all the varieties of mail clients our partners may use),
Some of those co-workers complains to us that we are spamming them. And if their are unable to transmit us the offending mail untouched (usually as an attachment, preserving the smtp conversation traces), we are helpless in determining by which way they have got our mailing which was not originally directed to them.
Is there a way using SmtpClient to set-up some properties which forbids "transparent forwarding" ?
I do not want to forbid normal forwarding or copying as in How do I prevent Lotus Notes users from forwarding or copying a message sent via System.Net.Mail? question.
I just do want to forbid that "transparent forwarding" (which is IMHO a very bad feature of some mail systems like MS Exchange, which in its rules options gives two way of forwarding, one being "transparent").
As this feature looks to me as being not compliant to smtp RFC, I really fear the answer is no or almost no.
But if your are aware of some custom header for forbidding this on some of those mail systems who do offer that transparent forwarding feature, it may still be of some help to me if their are settable using SmtpClient.
If you are trying to solve the problem of not knowing who the original recipient of the message is, then try adding a line in the body of the message something like this...
"This message was intended for (insert recipient here)."
You can make it visible so the user can see who the original recipient was, or (if you can) put it in super small font so you can use it for troubleshooting/spam claim illustration purposes.
Related
I work with a dozen pieces of equipment whose operating software has the option to send e-mails on error. I would prefer to capture the details of that e-mail on the host PCs that run them (i.e. for logging, communicating details automatically via Slack, etc.) rather than them going to an inbox somewhere.
Is there a way to have the software e-mail an address that is essentially a lightweight piece of code running on the same PC mimicking something like an SMTP server (that will allow me to get after the message's contents)? Other solutions I have seen are along the lines of setting up a full-blown server which seems like overkill.
You may configure SmtpClient to save email to a specific folder instead of sending it over the wire. Check this answer.
Also you must design your system in the way it could work with different implementations of your 'sender', so that you can replace it when you need that, for example during testing. In this case you can easily provide proxy implementation that will capture email content and then send it to localhost, or add aspects (make retries, logs performance...).
I'm trying to understand exactly what it is I need to be implementing and am just after a little guidance. I know very little about email standards such as POP3, IMAP, SMTP which is probably what's making the getting started difficult.
What'd I'd like to do consists of a couple of things:
Be notified of the arrival of an email at a specific custom address. e.g. hi.me#myapp.com.
Handle multiple addresses per user.
Be able to process this email and either delete it, leave it and be able to display in a web email client or forward it on based on various rules.
I've seen a few SMTP libraries and a POP3 one, but I'm not 100% sure what I need to do this. I'm guessing the best way would be to write a full C# mail server - but I'm hoping for a little guidance/suggestion.
Thanks
If you really want to build a mailserver from scratch, the protocol specifications are all available as RFCs.
For IMAP that would be RFC-3501 and for SMTP RFC-2821, you can google for the rest.
I've been working on a C# SMTP server in my (very limited) spare time, mostly out of frustration with existing MTAs and as an exercise in C# server programming. I can tell you that there's a bit more to it than you might think. So if you want fast results, I'd seriously consider hooking into an existing MTA/mailserver setup.
Depending on how fast you want to process messages, it may be sufficient to poll one or more mailboxes. You could process the messages and, for example, forward them to another mailbox using the built-in .NET SmtpClient.
On top of that, all mail servers I know of implement not just the SMTP protocol but also a slew of anti-spam measures. Most of these measures have matured over many years. You get all that for free if you build on top of an existing mail server infrastructure.
Then again, configuration of just about any mail server I know seems to be a fine art, hence my frustration with them.
I have been received a lot of emails "on behalf on". For example, the AddThis plugin sending a email from "addThis.com on behalf of myfriend#gmail.com".
How do I do this in C#/ASP.NET? Also, does this work if we use gmail for our SMTP, albeit branded to our company domain?
I'm also wondering if there are any concerns about this being unprofessional or getting flagged as spam on the client PC? In other words, have you guys actually implemented this...
You have three properties in the MailMessage class:
From
Sender
ReplyTo (or in .NET 4 the ReplyToList)
If you set the Sender different than the From, it should behave as you want it.
Please also see this SO posting for other aspects.
This is primarily a client app "feature". I'm guessing that you are viewing these email messages in Outlook, correct? Outlook (and possibly other email clients) compare the FROM address and the actual sender to see if they match. If they don't, Outlook will display the "On Behalf Of" information.
Most other email clients, and all web-based clients that I know of, simply display the "FROM" address as it was provided.
I am just now beginning to research this, and so far haven't come up with much. So, I'm hoping you guys can help me, or point me in some sort of direction.
I am in a situation in which I need to somehow be able to detect a failed email delivery and/or bounced-back email. Then, I need to be able to sent out a notification email describing this failure, as well as include some other, specific information in the notification email as well.
At the moment, I really have no idea how to do this. The email system we have now involves some C#.NET managed code, which send the email via an SMTP Exchange server. So, my initial thoughts are that I might be able to use email header information to accomplish this, but I'm not terribly family with all of the available email headers. I am also not at all opposed to finding and using some sort of third-party solution, but again, I'm not familiar with any such solutions or solution providers, and so I am very open to suggestions there too.
Are you using the SMTPClient class? If so, there's a SmtpFailedRecipientsException that would help you accomplish what you need.
Examples and further information given here:
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpfailedrecipientsexception.aspx
Not sure if you want to download messages from an IMAP server or a POP3 server. If it's the case, you may want to check out the Ultimate Bounce Inspector component. It also let you process EML files.
You can use PostMark which allows you to programmatically process bounced emails.
Is it possible to find POP3 server address for any given email id (like sam#mycustomdomain.com)? If yes, please provide some guidance preferably in PHP or .Net.
Edit :
I get addresses by querying MX record but those are not always the same which people use to fetch their emails.
I don't think you can "guess" the POP3 server for any email address and be right each time, no : the POP3 server can either :
be something like pop.thedomainnameintheaddress
or something totally different, like ssl.hostingcompany.com
In the first case, you could try to guess -- and sometimes be right... But in the second, you don't stand quite a chance.
You might want to take a look at Thunderbird 3 : I think it includes some auto-configuration mecanism about that : you enter your e-mail address, and it tries to find the POP server for your.
Not sure how it works, but I suppose there is a database containning that kind of informations, that Thunderbird sends requests to ; that would be the "best" solution, I'd say, as it can be updated without having to change Thunderbird itself, and doesn't rely on "guessing".
About Thundrbird's autoconfiguration mecanism, here's an interesting link : https://wiki.mozilla.org/Thunderbird:Autoconfiguration#Implementation -- especially the third point, which links to a directory where you can find configuration files for lots of domains.
For instance : https://live.mozillamessaging.com/autoconfig/gmail.com
Gets you an XML file indicating how Thunderbird has to be configured for #gmail.com emails.
And there's quite a couple of configuration files for other domains -- so this might be an interesting idea, at least for "well-known" domains ;-)
Of course, this doesn't solve the problem for non-well-known domains...
I don't think so; at least, not in a general way. Emails are just forwarded on to the right domain, and handled internally. For instance, my email address is stored on a server that provides both IMAP and POP access, and also forwarded to a webmail provider, who provide IMAP and POP access. So the question 'what's its POP3 server?' doesn't really make sense.
No, not really. It is however possible to find an smtp server for an email address. It is really not specific to any programming language, but the way you would go about it would be extract domain from email address (eg. me#somedomain.com => somedomain.com) and then make a dns query with type=MX. This will return the servers that accept mails for that domain, in order of priority.
If the question is, "For any given email address is there an automatic way to find the address of a POP3 server for it?" I'd say the answer is no.
Some people perhaps don't have POP3 access to their emails at all, and many people such as myself have our own domain hosted at a service provider and the POP3/IMAP servers are under the service provider's domains.