none
MailMessage - SmtpClient RRS feed

  • Question

  • Hello! Ive made a combobox with a list of smtpclient providers in my country, how can i set a smtp client provider from the selected item in the combobox or from a string?
    Here is what ive done, but it doesnt work. :)
     MailMessage mail = new MailMessage();
                mail.From = new MailAddress(textBox1.Text);
                mail.To.Add(textBox2.Text);
                mail.Subject = (textBox3.Text);
                mail.Body = (richTextBox1.Text);
                SmtpClient provider = new SmtpClient(comboBox1.SelectedText);
                provider.Send(mail);
    THANK YOU!
    Thursday, June 16, 2011 1:43 PM

Answers

  • Use :

    comboBox1.SelectedItem.ToString();

    NOT - Selectedtext

     

    Noam B.



    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
    • Marked as answer by nenson Thursday, June 16, 2011 1:52 PM
    Thursday, June 16, 2011 1:48 PM

All replies

  • Use :

    comboBox1.SelectedItem.ToString();

    NOT - Selectedtext

     

    Noam B.



    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
    • Marked as answer by nenson Thursday, June 16, 2011 1:52 PM
    Thursday, June 16, 2011 1:48 PM
  • thankyouverymuch! :)
    Thursday, June 16, 2011 1:52 PM