Tabs in email not equal over different email browsers - c#

In the asp.net (c#) application that im using/ building I am sending an email with spacing between words u use Tabs in the body but they never seem to be acting the same when going to an other email browser.
Is there a way to get them to act the same in Gmail and Outlook of even in Outlook 14.0 and 15.0?
Name:{{ Customer.Surname}}
Email: {{ Customer.Email}}

You could format your mail body as HTML and provide a stylesheet that specifies the spacing. A lot more work than just throwing tabs in, but the results will be more consistent.

I'm not sure I understand your question correctly, but you cannot use tabs to format emails reliably.
If you want to format your emails you need to create emails with an html part that includes the formatting that you need.

Related

MailKit/MimeKit.NET - Remove quoted messages within a replying email (from Outlook)

I want to strip the entire past mails to get the original mail body without any quotations using MailKit/MimeKit.
Getting the mails (via IMAP) is already done and working fine. But in case of a replying mail, the history of the written mails should be completely removed to get the original mail body by itself. The mainly used mail client is Outlook (customer), but also Thunderbird is in use of the support team.
I know, that there is this question, but this solves only the part for building the mail body for a reply (with all existing messages as quotation).
This functionality would be used for a ticket system.
How would you folks handle the deletion of the quotation from outlook?
(And maybe a more Outlook behavior of adding the existing mails as a quotation)
It sounds like what you want to do is the reverse of the other question.
The simple answer to that is to remove all lines that begin with ">" (or perhaps more specifically, lines that begin with "> ").
Then you'll also want to remove the line above the first line starting with a ">" (or "> ") - at least if it seems to have a date string in it.
Unfortunately it's not likely that a library exists to do this, so you'll probably have to write your own logic, but I could be wrong.
Hope that helps.

outlook removing my new lines (i have already tried everything mentioned to trick outlook)

so i have an email body I need to send in an email in outlook using a program I wrote in C#.
The body string has newline characters in it. I have tried everything to keep outlook from filtering them out. I even have the take out new lines option disabled and it still does it. I have tried every trick i could find on the web. I have tried Enviroment.NewLine and \r\n and anything else. It is so frustrating. Does anyone have any explanation???
If the message is sent as plaintext, most recent versions of Outlook will remove whatever it determines as extraneous newlines in the message to improve readability. Only the end user with the Outlook client has the ability to override this behavior and can do so on a message by message basis.
If you would like to have more control over the layout and formatting of the message, then you should generate your message body as an HTML message rather than a plaintext message. Of course this means that you have to do a little more work to create the message layout you want to use, but it will result in a very nice presentation and gives you much more control over things like vertical alignment and such that you cannot do reliably using just plaintext alone.

Sending HTML in e-mail

I need my .NET desktop app to be able to send various HTML mails, allowing users to create custom templates, including images and possibly CSS style (if they copy/paste the HTML from other sources).
From what I've been reading, it's not that simple:
Images need to be embedded and their links replaced with content IDs
CSS styles containing images also need to be fixed
Background color/image won't work, it's better to wrap the mail in a table and apply the CSS to it
SMTP servers can interpret lines starting with a dot as "end of transmission", so at least a space must be added to all such lines
Who knows what else
My questions are:
Is there anything else I should take care of?
Is there a library which already does this so that I don't reinvent?
One thing I can think of, make use of Alternate views for those recipients whose mail clients can't/won't accept HTML emails (or they've got it turned off). That way they'll get a plain text version, in which you could include a link to an html version live on the web if they decide want to view it.
I have also heard that not including a plain text version increases your likelyhood of being marked as spam - this is due to the fact that many mail filters compare the plain text and html versions of a message; if they differ too wildly it's not a good sign for you :-)
Other spam indicators include html messages which have more pictures than text, and generally sloppy html - broken css, bad links, missing tags etc - consider using some sort of markup validator before sending.
I have found the following CodeProject article, which describes how to embed various image resources into the mail:
Sending the contents of a webpage with images as an HTML mail.
It has some useful examples, although it doesn't seem to include an alternate plain text view, so I will have to add that.
It's still a pity that no-one has put together a library which does this stuff automatically.

How do I create active HTML inside the body of an email?

I am working on this small application that receives XML, converts it into HTML, and sends it to recipients. I want to create HTML in the message body that I will be able to work with, such as a text-area that the recipient will be able to write some text in and send it back to the sender. Is this possible, or can I insert just HTML With links into the mail body? I'm writing the app in C#.
Yes, it is feasible to include form fields in an HTML email, but it is not something you should get into the habit of doing. There are several problems with this approach:
If you come to rely on those forms, you run into problems with email clients that either don't support or don't enable HTML emails. It is certainly possible to include a separate text email, but you also run into problems where email clients will impose limits on message length that may run afoul of lengthy stretches of HTML code.
Even if the client does support HTML emails, HTML forms in emails are considered by many to be a security risk, so some email clients that allow HTML emails in general will disable HTML forms altogether.
You're better off including in every type of email you send out, plain text or HTML, a link to an HTML form on your site. This gives you one standardised form to secure, configure, and support, and also prevents you from dealing with email clients that don't support your message. Incidentally, since many email clients don't support Javascript, regardless of their support for HTML, you're somewhat limited in what you can work into HTML forms when you include them in the body of an email.
EDIT: For further reading, consult this link or this answer, both of which make similar points.

how can I get html code from selected text in asp.net?

I want to provide html email function in my application. But I don't know how to get html code from the text like
<br /> <b>,
etc. My application will provide user friendly user interface to let users to enter subject, email body and select attachment. The development environment is asp.net/c#. I use System.Net.Mail class to do email sending. I know I can write html email by using IsBodyHtml property, but how to get the html from the user interface?Does anyone have a solution?
Have you looked into the HTML Editor control provided by the ASP.Net AJAX Control Toolkit? It is probably the easiest route to give the editor a friendly interface to generate "rich text" with and for you to grab the underlying HTMl that generated it.
There are also numerous jQuery plugins available if you wish to go that route.
In fact, this is quite simple, I'd recommend you use some WYSIWYG Html Editor (or google "html editor for c#").
Basically, it writes html and javascript, for the textBox work as html editor, pretty the same when we are writing our questions and answer here in SO.
Have you looked for a Rich Text Editor that you can use for your users to enter their message (body)?
They usually have a function to get the HTML output of the text entered.

Categories