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.
Related
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.
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.
I have a customer service web app requirement, which requires that I work pull & integrate data from Gmail, eBay, Amazon, and Paypal. My solution is going to be developed in ASP.Net 4 with C#.
The issue that I'm running into is that my client needs pretty much all of the information that Gmail has about each and every email that comes in & the ATOM feed coming from Gmail seems to be a bit lacking. I realize I can also use POP3 or IMAP, but they too are lacking for a number of reasons.
Specifically, the client needs the read status of emails (whether or not THEY have read emails that were sent to THEM). They also need for all of the filters to remain intact. So if an email is tagged with x,y, & z, then I need to know about it.
The ATOM feed only shows me unread emails, so that's out.
POP3 has no clue (and rightfully so) whether or not they've read an email or not (unless I pull it into a database and manage read status, myself...but that doesn't work if they actually read a mail from within gmail itself).
IMAP seems like it would give me everything I need, but I'm not 100% sure on that. What do you all think? Also, IMAP is SOOO slow. Is anyone aware of any decent libraries that are fairly fast. We're talking about a customer inbox with some 360,000'ish messages at the present time, & the client would prefer to keep those messages at gmail & not work with a disconnected database.
Thoughts / Opinions?
IMAP does provide read/not-read status for each message and you can pull from particular 'labels' (folders) or just pull from the 'all messages' bucket. You don't need to pull the entire message either, you can ask for headers only, giving you the ability to quickly scan many emails.
I've been working on a program to pull my entire gmail dataset down for my own tinkering and processing. I'm using linux, and while there are a multitude of imap 'mirror' and imap 'processing' applications out there, I just want to play with the data, being able to do what I want with it, without stuffing it back into an imap server locally. It's been working decently and I'm using the email's UID (modified slightly) as a file name to dump the headers & email data. Of course, you could massage the data and update a database or whatever at that point, I'm just stashing it for post-processing later. Looking for trends in my email, mostly tinkering.
I tried using the etpan libraries for IMAP processing, didn't find them to my liking, so I've been pulling imap routines from other email programs and servers to play with. I have the RFC's, but really really trying to not reinvent the wheel here if I can help it.
Yup, not the best answer, but hopefully some information to help. I imagine there are nice libraries for PHP, or other web-based systems, I've been working with C++/C myself.
I'm wondering whether anyone can help me with how to set up mailboxes for my silverlight application users.
Sending e-mails was simple enough, but now it seems to get tricky.
How do I implement an IMAP or POP3 service?
I've followed a couple of questions here on SO, but the answer is still eluding me...
Can anyone maybe send me a in general direction?
Any useful answers would be very much appreciated.
You can use the MailSystem.Net (LGPL). It provides full support for SMTP, POP3, IMAP4, NNTP, MIME, S/MIME, OpenPGP, DNS, vCard, vCalendar, Anti-Spam (Bayesian , RBL, DomainKeys), Queueing, Mail Merge and WhoIs.
Never tried this but heard of it one time:
http://www.emailyak.com/
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.