开发者

I want to send a textBox value in email in C#. some one Help me?

I want to send a textBox 开发者_运维技巧value in email in C#. some one Help me?


see Scott Gu's article to send Sending Email with System.Net.Mail here.

Load the body of the mail with the TextBox.Text value


txtBox.Text;

will give you the value in C#

TextBox.Text Property


you can try something like this

MailMessage msg = new MailMessage();
msg.From = "test@mail.com";
msg.To.Add("rec@mail.com");
msg.Subject = "test";
msg.Body = yourTextbox.Text

SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = _smtpHostName; //host name
smtpClient.Port = _smtpPort; //required port
smtpClient.Send(msg);

Have a look at

SmtpClient Class

and SmtpClient Constructor (String, Int32)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜