Click here to Skip to main content
16,010,650 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows Services and .config files Pin
Esmo20003-Feb-05 3:25
Esmo20003-Feb-05 3:25 
GeneralCreate when you need it - best practices Pin
Judah Gabriel Himango2-Feb-05 8:27
sponsorJudah Gabriel Himango2-Feb-05 8:27 
GeneralRe: Create when you need it - best practices Pin
Robert Rohde2-Feb-05 8:54
Robert Rohde2-Feb-05 8:54 
GeneralRe: Create when you need it - best practices Pin
Judah Gabriel Himango2-Feb-05 8:58
sponsorJudah Gabriel Himango2-Feb-05 8:58 
GeneralRe: Create when you need it - best practices Pin
Robert Rohde2-Feb-05 9:09
Robert Rohde2-Feb-05 9:09 
GeneralRe: Create when you need it - best practices Pin
Judah Gabriel Himango2-Feb-05 9:27
sponsorJudah Gabriel Himango2-Feb-05 9:27 
GeneralRe: Create when you need it - best practices Pin
Judah Gabriel Himango2-Feb-05 9:59
sponsorJudah Gabriel Himango2-Feb-05 9:59 
GeneralMail Encoding using MailMessage Pin
[DAve]2-Feb-05 8:16
[DAve]2-Feb-05 8:16 
Hi,

I should first make it clear I know virtually nothing about c# & .NET (so please speak slowly and use short wordsBig Grin | :-D )

I'm modifying a c# program someone else wrote which, as part of its process sends a mail using MailMessage.

This works... However when the message arrives some (not all) of the new lines (CR,LF) are messed up.

I noticed that if I open the mail in outlook and go View->Encoding this is set to "Western European (ISO)" if I switch this to "Western European (Windows)" the lines look right again.

So I looked into this and noticed the BodyEncoding member, but still can't get this working.

My code is
<br />
	MailMessage mail = new MailMessage();<br />
<br />
	mail.To		= "me@somewhere.com";<br />
	mail.Cc		= "";<br />
	mail.Bcc	= "";<br />
	mail.From	= "Someone@SomewhereElse.com";<br />
	mail.Body	= <String read from a file somewhere>;<br />
	SmtpMail.SmtpServer = "smtp.MyServer.com";<br />
	SmtpMail.Send( mail );<br />
<br />


I have tried adding...
<br />
	mail.BodyEncoding	= System.Text.Encoding.GetEncoding(1252);<br />

and
<br />
	mail.BodyEncoding	= System.Text.Encoding.Default;<br />


but still the message is always displayed as "Western European (ISO)", does anyone have any idea how I can fix this?

Cheers

DAve
QuestionSystem.Exception: CFCC is an invalid expression???? Pin
Member 15229922-Feb-05 8:08
Member 15229922-Feb-05 8:08 
GeneralSettings Window Height Pin
Guinness4Strength2-Feb-05 8:06
Guinness4Strength2-Feb-05 8:06 
GeneralRe: Settings Window Height Pin
Robert Rohde2-Feb-05 8:22
Robert Rohde2-Feb-05 8:22 
GeneralRe: Settings Window Height Pin
Guinness4Strength2-Feb-05 8:29
Guinness4Strength2-Feb-05 8:29 
GeneralCustom MessageBox Buttons Pin
JMichael24682-Feb-05 6:47
JMichael24682-Feb-05 6:47 
GeneralRe: Custom MessageBox Buttons Pin
Robert Rohde2-Feb-05 9:02
Robert Rohde2-Feb-05 9:02 
GeneralExposing class library to COM Pin
Rein Petersen2-Feb-05 6:32
Rein Petersen2-Feb-05 6:32 
GeneralRe: Exposing class library to COM Pin
Judah Gabriel Himango2-Feb-05 8:34
sponsorJudah Gabriel Himango2-Feb-05 8:34 
GeneralConverting int / long to byte[] Pin
Tristan Rhodes2-Feb-05 4:22
Tristan Rhodes2-Feb-05 4:22 
GeneralRe: Converting int / long to byte[] Pin
Some Idiot2-Feb-05 4:39
Some Idiot2-Feb-05 4:39 
GeneralRe: Converting int / long to byte[] Pin
Tristan Rhodes2-Feb-05 6:27
Tristan Rhodes2-Feb-05 6:27 
GeneralCalling Functions in Other Forms. Pin
Dwayner792-Feb-05 4:17
Dwayner792-Feb-05 4:17 
GeneralRe: Calling Functions in Other Forms. Pin
Michael Potter2-Feb-05 4:57
Michael Potter2-Feb-05 4:57 
GeneralRe: Calling Functions in Other Forms. Pin
Dwayner792-Feb-05 6:25
Dwayner792-Feb-05 6:25 
GeneralRe: Calling Functions in Other Forms. Pin
Michael Potter2-Feb-05 7:32
Michael Potter2-Feb-05 7:32 
GeneralRe: Calling Functions in Other Forms. Pin
Dwayner792-Feb-05 8:10
Dwayner792-Feb-05 8:10 
GeneralRe: Calling Functions in Other Forms. Pin
Michael Potter2-Feb-05 10:08
Michael Potter2-Feb-05 10:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.