На линииНе удается передать переменную из текстового поля
const string subject = "hello" + textBox1.Text;
не печатает значение TextBox1.Text но я напечатать слово «TextBox1.Text». Как я могу это исправить?
var fromAddress = new MailAddress("[email protected]", "samui mail");
var toAddress = new MailAddress("[email protected]", "To Name");
const string fromPassword = "t429";
const string subject = "hello" + textBox1.Text ;
const string body = "you have a mail";
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
Subject = subject,
Body = body
})
{
smtp.Send(message);
}
Пробовал удалить const? string subject = "hello" + textBox1.Text; – aliassce