how to add textbox in the mail body? - c#

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.

Related

How do I send output of ASP.NET webforms site to a string/email ?

There is a site for sales where the end user prints out the details for the customer and that already contains all the information/HTML/ASPX page.
They want me to now send this HTML to the user as an EMAIL...
So rather than recreate each piece bit by bit.. is there someway to tell the server when it is done rendering the page to send the output to a string perhaps? Then I could have a function that takes that HTML in the string and creates an email with it.?
Don't send the exact HTML of your page as an email, as the results likely won't be good when viewing in their email client. Instead, custom generate the body of your email, and send it using the functionality in the System.Net.Mail namespace. Probably start with MailMessage and SmtpClient.
A page is usually formatted for a large browser window and contains much extra stuff like JavaScript and navigation elements. And it often refers to external CSS files for formatting. Consider that this wouldn't look very good when viewed in an email client. So yes, better to hand code or at least selectively get the HTML of your relevant Controls and send that rather than sending the HTML for the entire page.

Retrieve E-mail from server (pop3) by date for filtering on subject or body in C#

I have a piece of monitoring software I am writing which needs to retrieve e-mails sent to an address for a certain day so that I can filter them by a regex in the subject or body. I don't need to retrieve the entire message, only the subject and body for all messages on a given day so that I can evaluate them with a regular expression for a token.
I looked at EAGetMail as a solution, but their implementation doesn't do what I need to to do. I can only get all information on mail, which only has the size and index. I would need it by subject, but even then I don't want to get everything in inbox. If I went with this solution I have to get all mail, and then retrieve each mail message individually to evaluate the subject and body. This is not ideal.
I also looked at OpenPop.Net, but it too does not have a targeted retrieval for today's messages only.
Can I even do what I want without looping through every single email on the server until I find a match? What is the best way to accomplish what I am trying to do? Am I going to have to build a custom web request to get the data I want? Also, I looked at Chilkat, but I am looking for a free solution, even if it means building the http request myself.
dont know if this helps you at all because it is vb.net however, if you combine with the other link it may help.
http://www.codeproject.com/KB/smart/EmailClient.aspx

HTML E-mail: Must you send an alternate plain text view as well?

When sending HTML e-mail, I understand that it's a best practice to send a plain text version as well.
But my question is: Must you send a plain text version as well?
What are the repercussions?
At least as far as Outlook 2007 is concerned, there are no reprecussions. We have an internal app that sends out emails in HTML format only and Outlook doesn't complain and renders the HTML content.
Sending an email with a plain-text version is simply common courtesy to support email clients that either don't support HTML format, or have their client set to render plain-text only. It's actually more prevalent than you may think so if you can either ask the user their preference or send both.
You never have to. If the recipient however, is unable to receive HTML emails or their client does not support them then chances are the HTML will be displayed as plain text. Also, some email providers/clients like Verizon, GMail or Outlook will strip out certain tags so you HTML is malformed.
Ideally you should collect the user preference of email and send the email based on this preference, it is impossible to guess what they prefer. This is not so much a best practice thing as opposed to a user preference, though it is rare now that users have email clients incapable of rendering html content, this does not preclude however email clients blocking html content (like GMail, Outlook) unless explicitly allowed by the user.
On my humble opinion you must think on the receivers of the mail you are trying to send. I mean, if they have Mail User Agents that support a given format or not.
Also, you should be aware of making a compatible HTML e-mail otherwise it won't be interpreted right on every Mail User Agent.
Hope that helps,
Think that, for example, Gmail interface shows in the header the first lines of the e-mail, and Outlook does too, if you send an HTML e-mail without plain text version, the text won't be displayed, at least in my case.
What I've seen from dozens of e-mails is that they normally include a line that tells:
If your e-mail client doesn't support HTML go to http://....
Another thing that I can tell you is that, for example, the iPhone downloads first the plain text message, and later the html formatted one.

How do I use the Windows Mail Protocols? (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

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