How do I use the Windows Mail Protocols? (C#?) - c#

Well, for my program(s) I'd like to let the user send me an e-mail with any errors. Instead of relying on a forsaken SMTP server, I decided to let the user use his very own e-mail client to send an e-mail to a specified address.
So what I need is:
A sender (should not be changeable) (example: mysupportemail#gmail.com)
An attached file (should not be changeable) (example: "C:\a file.log")
(Optional) A body (changeable)
I hope it is possible!

You can use the mailto command for this. See http://msdn.microsoft.com/en-us/library/aa767737(VS.85).aspx for more information. Some mail clients support attachments on this. See the comments of the MSDN page for some information on this.

The mailto protocol has limitations, such as not being able to specify an attachment (some mail clients support it, but it's not in the official protocol). Your best option is probably to use the MAPISendMail function to let MAPI do the hard work. See this article for details:
Sending files via the default e-mail client
I used this technique in the past, it seems to work perfectly.

Using mailto directly from you application cause potential problems. If you have specified mail account for receive e-mails you can be sure, that someone will use it somehow to sent you spam or thousands unwanted emails. In our company we struggled with this problem many times - at last, we decided to allow our customers to report problems in any other way - web page form.
Now, when customer click 'report problem' this option displays a form for reporting bugs in default web browser. Opened link include some additional information which causing partial fill of the form opened by customer. Now, we have an intermediate layer and absolute control on server side who report problem (ip) and we can limit reporting for specified users. Next advantage of these solution is that you can forward emails to different departments depending on what form fields are marked/filled with.

Well, I have found the perfect solution!
For those who want to see it...
http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8
http://www.eggheadcafe.com/community/aspnet/2/10019665/email-through-gmail-in-c.aspx

Related

Add PDF attachment to BizTalk email service

I have come into ownership of a ASP.NET MVC site that utilizes Biztalk 2013 to handle tasks like sending emails. I am completely new to biztalk so forgive obvious mistakes in this post.
Quick overview
The service is called through the application and then the orchestration calls a stored procedure in a sql db to populate some of values for the email (including html for the email) and then sends the email out.
I now want to add a pdf attachment to the email.
As a test, I added a pdf file to the server and then I have tried adding ActualEmailMsg(SMTP.Attachments) = "C:\\PDFs\\test.pdf";
ActualEmailMsg(SMTP.MessagePartsAttachments) = 2; to the message assignment expression shape as suggested in this post to no avail. (I also tried the physical path with only 1 "\" like "C:\\PDFs\test.pdf" and that didn't work)
I have ruled out the possibility of a lack of permissions from the service account to the PDF folder. The email sends correctly but no attachment is present. I am getting no errors in the code or in the event viewer on the server so at this point I am at a loss for what it might be.
After lots of googling I found the issue was related to the send pipeline. This thread got me on the right track.
In the send ports section of the BizTalk Admin Console of the app, the send pipeline was using a custom pipeline I believe was made by the previous owner. I changed it to the 'Pass Thru Transmit' type in the dropdown and it is now working.
I use the following pattern for sending Emails. I’m not sure but maybe you need to use the ActualEmailMsg(MIME.FileName) attribute for message in email.
ActualEmailMsg(MIME.FileName) ="Report_{"+FullFileName+"}.xml";
ActualEmailMsg(SMTP.CC)=ReportNotificationEmailAddress;
ActualEmailMsg(SMTP.Subject)="Report Notification Email";
ActualEmailMsg(SMTP.EmailBodyFile)=#"C:\...\ReportNotificationBody.htm";
ActualEmailMsg(SMTP.Attachments)=#"C:\..\ReportNotificationBody.png”;
ActualEmailMsg (SMTP.EmailBodyTextCharset)="UTF-8";

how to check whether a user opened the mail we sent

Using Amazon AWS we can know how many mails are delivered,how many bounced and how many were rejected.But how to check whether user has opened our mail and clicked on the link we have given in our mail.And using getsendstatistics() method of AWS we can only get the number of bounces,rejects and delivered mails.Is there any method which gives us the details whether a user opened his mail or not.
There is no reliable way to do this.
You could make a webserver that serves an image (just a white pixel would do) and have it report if the image is loaded or not, perhaps even include a querystring to identify the user loading the image. The problem with this is that any modern mailclient will not load images in the email by default.
The mail protocol allows for two different methods (mail header entries) to request a "receipt" when the receiver opened the mail. If activated you will get a mail back which contains the receipt along with time and mail client infomation.
It is completely optional if the receiving client will honor the request however, so these methods may help but are not reliable at all.
From wikipedia article about Email tracking
The technical term for these is "MDN - Message Disposition
Notifications", and they are requested by inserting one or more of the
following lines into the email headers: "X-Confirm-Reading-To:";
"Disposition-Notification-To:"; or "Return-Receipt-To:".

Identify if an email address is 'public'

I would like to identify if an email address comes from a public provider or is from an established business. I consider public email addresses to be things such as:
Open email service providers, such as
gmail, hotmail and yahoo.
Anonymization services, such as mailinator or dispostable.
I'm aware that there is no foolproof way to do this, and obviously any list based solution would require constant updates.
Is there a public listing or .NET library that can do this for me?
Are there really that many free webmail providers out there? I would go with a 'blacklisting' style solution.
For example, flag everything in this wikipedia list as free (heck I would think covering gmail/hotmail/yahoo/aol would cover a huge % of users anyway). Then if you get more than 2 (or higher number if your site has high throughput) registrations from the same email domain, it notifies the admin to check the domain to see if it needs to be added to the 'blacklist'.
I would imagine there are much more reliable ways to detect business customers though. For example in Australia you could just ask for an ABN and then check that it's valid. Are you willing to punish small business who don't have email providing and just use a generic #gmail account?
Here is a link to SpamAssasin's freemail list: http://svn.apache.org/repos/asf/spamassassin/trunk/rules/20_freemail_domains.cf.
I suppose, checking against this list is a good start.
You might want to talk to the Better-Business-Bureau ( http://www.bbb.org ) and see if they provide some kind of a feed or API. I had a quick look at their site and couldn't see anything obvious, but it would be this kind of organisation I would head to first if I wanted to find out domain names belonging to established businesses. They do have a form on their site to search by email address ( http://www.bbb.org/us/Find-Business-Reviews/ )
Consider using HubSpot blocked domains list. It is not a guarantee that it is 100% accurate or complete.
They also provide a CSV file that you can download and parse programmatically. Link to CSV file is in the linked page.
I am guessing the ultimate goal is to clean your database from unwanted contacts that will increase the monthly bill. What you can do is the following:
Create a webhook that is triggered whenever a new contact is added.
In that webhook (which can be written in any language), check if the contact is in a blacklist (which is gmail/etc...).
Remove the contact if it is in a blacklist using an API call (you will need to first get the contact ID, which can be easily retrieved using API).

how to add textbox in the mail body?

I am using asp.net and C#.
I have a requirement in which i need to add one textbox in the mail body.
After the user registration, i need to send a welcome mail. i tried to add the input tag in the mail body, but i am able to see on [ ](two square brackets).
Can anyone tell me how to do this?
I wouldn't do this. Like other people said: this is impossible at best.
Think of the vast variety of email clients nowadays and the Spam community actively trying to break hell loose on your computer each day. Basic HTML is allowed in email, images (if not embedded) are blocked, Javascript is not allowed.
For your own sake, try to redefine this requirement to be input on a webpage with a link in the welcome email. If you continue to find a solution to this, you'll end up pulling your hair out.
Guess this is impossible.
AFAIK, HTML email is rendered at the client using a parser, not a fully functional web client.
So I don't know email clients which will allow you to do this.
More information about HTML e-mails could be found here.

Avoiding email being marked as spam when sent through gmail mail server

Hi all (before closing based on the title, please read the bottom parragraph),
I'm having some small issues with emails being sent out from the C#/ASP.Net webapp that I'm currently developing.
We don't send emails out on mass, only to a single address, sometimes with a CC address.
The emails we are sending out contain one attached file, which is a single page PDF file (They are actually invoices in PDF format).
It's happened a couple of times that our emails have been flagged as spam. The content of the email is HTML without any images, and the HTML itself is not very complicated at all (Simply 4 p tags and an a tag with a mail to).
We have a company domain set up using the Gmail smtp server, and the email account with we use to send this email is called automated.emailer.
When created the System.Net.MailMessage, I am adding a simple name to the which is "XXX invoicing" (XXX is substituting our company name) using the MailAddress constructor which takes a display name, a replyto address of Invoicing#example.com and the from address is automated.emailer#example.com. The content has been checked against many sp
These emails are fairly important, so we need to do all we can to avoid them being caught as spam. I would appreciate any ideas on why these emails would be considered spam? It may be that, in order to make sure the IP of our domain matches the IP of the mail server, we need to install an exchange. This seems like a strong approach and I'd be keen to see if anyone has solved this problem in another way.
I have tried to ask this question with as much info as possible, to avoid this question being closed, since i've seen many questions regarding email spam closed with a reference to the below question, which I read, but didn't find an answer to my question.
How do you make sure email you send programmatically is not automatically marked as spam?
Probably better on superuser.com rather than here. But have you tried looking at SPF records? Might boost your credibility to spam filters.
I use the free service over at Port25. You send an email to their verifier address and get a reply with a pretty detailed breakdown of your ham score:
http://www.port25.com/support/authentication-center/email-verification/

Categories

Resources