vipuljpatel
Programmer
HI ALL,
We need help on the following in C#.
We want to send Email from my Application build in C#. It should work both ways.
1. It should just create a mail in outlook express or Microsoft outlook with my parameters.
2. Also, it should send a mail directly without allowing the user to edit.
We tried some thing like this.
*-----------------------------------------
MailMessage msg = new MailMessage();
msg.From = "me@my.mail.server";
msg.To = "you@your.mail.server";
msg.Subject = "how to send mail using VC#.NET";
msg.Body = "this is the answer";
msg.BodyFormat = MailFormat.Text // can be MailFormat.HTML
SmtpMail.SmtpServer = "smtp.yours"; //assign smtp server here
SmtpMail.Send(msg); //this line actually fire the msg out
*-----------------------------------------
But this did not work.
If We set "SmtpServer" with my smtp server name, error is generated. "Could not access 'CDO.Message' object ". And if We do not give the "SmtpServer" (use default) then the error is not generated but no mail is sent. What are We doing wrong here. please suggest.
Also, Can anyone suggest us a component/product available free or otherwise that We can use for this purpose. We have seen some at google search but am confused. Please make your sugesstions basd on your experiences.
TIA,
Regards,
Vipul
We need help on the following in C#.
We want to send Email from my Application build in C#. It should work both ways.
1. It should just create a mail in outlook express or Microsoft outlook with my parameters.
2. Also, it should send a mail directly without allowing the user to edit.
We tried some thing like this.
*-----------------------------------------
MailMessage msg = new MailMessage();
msg.From = "me@my.mail.server";
msg.To = "you@your.mail.server";
msg.Subject = "how to send mail using VC#.NET";
msg.Body = "this is the answer";
msg.BodyFormat = MailFormat.Text // can be MailFormat.HTML
SmtpMail.SmtpServer = "smtp.yours"; //assign smtp server here
SmtpMail.Send(msg); //this line actually fire the msg out
*-----------------------------------------
But this did not work.
If We set "SmtpServer" with my smtp server name, error is generated. "Could not access 'CDO.Message' object ". And if We do not give the "SmtpServer" (use default) then the error is not generated but no mail is sent. What are We doing wrong here. please suggest.
Also, Can anyone suggest us a component/product available free or otherwise that We can use for this purpose. We have seen some at google search but am confused. Please make your sugesstions basd on your experiences.
TIA,
Regards,
Vipul