473,761 Members | 9,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending mail message with unicode text

Hello.
I have a problem with sending Unicode text in mail message.
So what I do:

First of all I have some template file like this:
=============== =============== ===
<html>
<head><title>Te st Message</title></head>
<body>
<p>Hello {0}</p>
</body>
</html>
=============== =============== ===

This text will include Unicode text too.
Late I want to load this text and replace "{0}" with some value and send it
by mail.
then I do following:
=============== =============== ===
// Read message text from predefined file
System.IO.TextR eader textReader = new System.IO.Strea mReader(fileNam e);
text = textReader.Read ToEnd();
textReader.Clos e();

// Assign message
MailMessage mailMessage = new MailMessage();
mailMessage.Fro m = "so**@mail.com" ;
mailMessage.To = "so**@mail.com" ;
mailMessage.Sub ject = "Test";
mailMessage.Bod y = String.Format(t ext, "some UNICODE text");
mailMessage.Bod yFormat = MailFormat.Html ;
mailMessage.Bod yEncoding = Encoding.Unicod e;

// Send message
SmtpMail.SmtpSe rver = Settings.GetVal ue("SmtpServer" );
SmtpMail.Send(m ailMessage);
=============== =============== ===

Now about the problem:
when I got message sent by this code it looks something like this: (actually
this is an anothe mail)
=============== =============== ===
< h t m l > < h e a d > < t i t l e > R e g i s t e r i n g p r o p e r t y
< / t i t l e > < / h e a d > < b o d y > < p > < b > T h a n k y o u f o r
r e g i s t e r i n g y o u r p r o p e r t y w i t h R i g h t M o v i e ..
g e < / b > < / p > < p > Y o u r r e g i s t r a t i o n n u m b e r i s 1
9 3 3 9 6 a n d y o u s h o u l d q u o t e t h i s o n a n y c o r r e s p
o n d e n c e .. < / p > < p > Y o u r p r o p e r t y w i l l b e d i s p l
a y e d o n t h e R i g h t M o v i e .. g e w e b s i t e u n t i l 0 3 ..
1 2 .. 2 0 0 5 .. Y o u m a y r e n e w o r u p d a t e y o u r r e g i s t
r a t i o n a t a n y t i m e b y c l i c k i n g o n < a h r e f = " h t t
p : / / 2 1 3 .. 1 5 7 .. 2 0 1 .. 2 3 4 / R i g h t M o v e / P r o p e r t
y R e n e w .. a s p x ? r e g n u m = 1 9 3 3 9 6 " > h t t p : / / 2 1 3
... 1 5 7 .. 2 0 1 .. 2 3 4 / R i g h t M o v e / P r o p e r t y R e n e w
... a s p x ? r e g n u m = 1 9 3 3 9 6 < / a > .. < / p > < p > T h i s s e
r v i c e i s p r o v i d e d F R E E O F C H A R G E , s o p l e a s e t e
l l e v e r y o n e a b o u t R i g h t M o v i e .. g e .. < / p > < p > <
u > < b > D e t a i l s o f P r o p e r t y : < / b > < / u > < / p > < p >
< b > D i s p l a y e d U n t i l : < / b > 0 3 .. 1 2 .. 2 0 0 5 < b r > <
b > T y p e o f p r o p e r t y o r l a n d : < / b > ? ? ? ? ? < b r > < b
R o o m s : < / b > 4 ? ? ? ? ? < b r > < b > R e c e p t i o n r o o m s : < / b > 1 ? ? ? ? ? ? ? ? ? ? ? ? ? < b r > < b > A s k i n g P r i c e :
< / b > $ 9 9 .. 0 0 < b r > < b > H o u s e / A p p a r t m e n t # : < / b 9 < b r > < b > S t r e e t : < / b > ? ? ? 9 9 9 < b r > < b > D i s t r i c t a n d T o w n : < / b > ? ? ? ? ? ? ? < b r > < b > C o n t a c t : <
/ b > 9 9 9 < b r > < b > T e l e p h o n e : < / b > 9 9 9 < b r > < b > F
a x : < / b > < b r > < b > M o b i l e : < / b > < b r > < b > E - m a i l
: < / b > < a h r e f = " m a i l t o : d a v i d @ d s l .. g e " > d a v i
d @ d s l .. g e < / a > < b r > < b > E s t a t e A g e n t : < / b > ? ? ?
< b r > < b > P r o p e r t y D e s c r i p t i o n : < / b > 9 9 9 < b r >
< b > S t a t u s : < / b > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? < b r < b > E n t r y t y p e : < / b > ? ? ? ? ? ? ? ? ? ? ? < / p > < p > R i

g h t M o v i e .. g e a c c e p t s n o r e s p o n s i b i l i t y f o r t
h e a c c u r a c y o r a v a i l a b i l i t y o f t h e i n f o r m a t i
o n d i s p l a y e d o n i t s w e b s i t e a n d a c c e p t s n o l i a
b i l i t y f o r l o s s o f e a r n i n g s o r l o s s o f c a p i t a l
g a i n s t h r o u g h u s e o f i t s s e r v i c e s .. < / p > < / b o d
y > < / h t m l >
=============== =============== ===

When I don't use mailMessage.Bod yEncoding = Encoding.Unicod e; it send normal
mail but with "?" character instead Unicode symbols.

So how can I load from file then replace some values and send HTML format
Unicode text?

Thank you.


Nov 17 '05 #1
0 2206

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9241
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends - I see hebrew, it is just sending by myself using *.aspx scripts). In web.config I have the following : <configuration> <system.web>
0
1269
by: michi | last post by:
Hello :) When I execute following asp.net code **** Web.Mail.SmtpMail.SmtpServer = "squadron" Web.Mail.SmtpMail.Send("wwwmike@gmx.ch", "wwwmike@gmx.ch", "subj", "message") ****
1
6919
by: David Dvali | last post by:
Hello. I have a problem with sending Unicode text in mail message. So what I do: First of all I have some template file like this: ================================= <html> <head><title>Test Message</title></head> <body> <p>Hello {0}</p>
6
2750
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
2
12175
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used, error is thrown at the .send point. Error is: The following error occured Sending an email: System.ApplicationException: An error occurred sending an email To helen@HerMail.com From ade@MyMail.com Cc Subject A test with Finlistener #1. The body...
2
6827
by: satnamsarai | last post by:
Using System.Net.Mail: Sometimes I get error 'failure sending mail. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.' Not sure how to fix this error. I am able to send messages sometimes both other times randomly following error appear EXCEPTION:
4
2403
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its working fine. However I was wondering if there is a way to confirm that the email was sent. The send method does not return anything....
8
3807
by: Marty | last post by:
I'm having issues sending an email to an "@page.nextel.com" email address. I can send to any other email address fine, but when I try the page.nextel.com it gives me this error: Final-Recipient: XXXXXXX@page.nextel.com Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF characters. Action: failed Status: 5.0.0
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9988
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9923
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.