Pergunta

I have a simple application written that allows users to pick inventory items with checkboxes. When the items are checked a textbox is populated showing the user's input. I would like to have a class that would take the contents of the textbox and copy it to a new outlook email with the TO address pre-populated with myemail@gmail.com. ASP.Net is foreign to me and I am a very new C# coder SO I have no idea how to do this. Any ideas.

I have seen an example online as follows...

 System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();
 message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 );
 message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","SmtpHostUserName" );
 message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","SmtpHostPassword" );

 message.From="from e-mail";
 message.To="to e-mail";
 message.Subject="Message Subject";
 message.Body="Message Body";
 System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address";
 System.Web.Mail.SmtpMail.Send(message);

but I have errors everywhere and think that I'm not implementing this right. Is there a simpler way to do this or just a way I might be able to understand. Thanks to any and all answers. I can only check one but I appreciate them all.

Foi útil?

Solução

http://support.microsoft.com/kb/310263

I am guessing you are not using the Outlook object library. If you want to, then the code is right there.

The only change you will have to make will be

  oMsg.Body = TextBox1.text;

where TextBox1 has the all the contents that you wanted to send as the message body.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top