-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: niyati
Message 19 in Discussion
New Message on MumbaiUserGroup
Sendmail.Smtpserver:C#
Reply
Reply to Sender
Recommend
Message 18 in Discussion
From:
niyati
New Message on MumbaiUserGroup
Sendmail.Smtpserver:C#
Reply
Reply to Sender
Recommend
Message 16 in Discussion
From:
niyati
New Message on MumbaiUserGroup
Sendmail.Smtpserver:C#
Reply
Reply to Sender
Recommend
Message 15 in Discussion
From:
niyati
I am using Window Forms, Language=C# In the config file I have
hardcoded the email address and the email servers IP. I have used
System.Web.Mail namespace. Everything works fine on my machine. But same
executable gets stuck on the clients machine when mail sending part is
encountered. Below is the Sendmail.cs code used by me:
public void SendMessage(string myFileName,string myBody,string mySubject)
{
try
{
try
{
MailMessage Message = new MailMessage();
MailAttachment ma=new MailAttachment(myFileName);
Message.To = ConfigurationSettings.AppSettings["ToEmailAddress"];
Message.From = ConfigurationSettings.AppSettings["FromEmailAddress"];
Message.Subject =mySubject;
Message.Body=myBody;
Message.Attachments.Add(ma);
try
{
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["EmailServer"];
SmtpMail.Send(Message);
}
catch(System.Web.HttpException ehttp)
{
MessageBox.Show(ehttp.ToString());
}
}
catch(IndexOutOfRangeException ex)
{
MessageBox.Show(ex.ToString());
}
}
catch(System.Exception e)
{
MessageBox.Show(e.ToString());
}
}
For this I have made a common class file "Sendmail.cs ". The other class files
call it in the following way:
SendMail sm=new SendMail();
sm.SendMessage(STLog.mydate,"Hi,\n\nIt has been executed.\n\nPlease find the
report attached for the same.\n\nThank You.\n\n","Status: Report."); Please
help me to solve this problem. Thanks & Regards, Niyati
View other groups in this category.
View other groups in this category.
View other groups in this category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]