joe_pool_is
Contributor
I've got some code that is chopping my subject line on the messages I receive, and I do not know why.
Our server is running Active Directory and SQL Server 2000 Enterprise.
The email is sent, but all we see in the subject line is "S". More debugging information: We do not reply to these system messages very often, but whenever we do, the header information (From, Sender, Date, Subject) all looks like it is in Chinese!
Here is what I am doing:
If someone can catch it, I would sure appreciate knowing what I'm doing wrong.
Our server is running Active Directory and SQL Server 2000 Enterprise.
The email is sent, but all we see in the subject line is "S". More debugging information: We do not reply to these system messages very often, but whenever we do, the header information (From, Sender, Date, Subject) all looks like it is in Chinese!
Here is what I am doing:
C#:
private bool SendMessage(string fcn)
{
MailMessage email = new MailMessage(fcn, fcn);
email.SubjectEncoding = Encoding.Unicode;
email.BodyEncoding = Encoding.Unicode;
email.Subject = string.Format("SystemID {0} - {1}", m_systemId, m_coil.SerialNumber);
string fmt = "<html><body bgcolor={0}><div><h3>Coil {1}<br/><font color=\"red\">{2}</font> Approved Override For {3}</h3><hr><table border=1>";
string body1 = string.Format(fmt, split.Panel1.BackColor.Name, m_coil.SerialNumber, m_dbase.Supervisor.FullName, m_dbase.Employee.FullName);
string body2 = string.Empty;
foreach (ListViewItem i in ListView1.Items)
{
if (i.ImageKey == "stop.ico")
{
body2 += string.Format("<tr><td>{0} Issue:</td><td><b><font color=\"green\">{1}</font></b></td></tr>", i.SubItems[0].Text, i.SubItems[1].Text);
}
}
if (0 < body2.Length)
{
string body3 = "</table><hr></div><div>End Of File</div></body></html>";
email.IsBodyHtml = true;
email.Body = body1 + body2 + body3;
SmtpClient Client = new SmtpClient("172.16.8.200");
try
{
Client.Send(email);
}
catch (Exception err)
{
Console.WriteLine(err.Message);
}
finally
{
email.Dispose();
}
}
}