[Resolved][2005] The specified e-mail address is currently not supported.
i am trying to send an email to 1 or more persons and when i get to mail.To.Add(TextBox6.Text) i get the following error. any help will be great
thanks in advance.
The specified e-mail address is currently not supported.
here is the code i am using
Imports System.Net.Mail
Imports System.Net
Dim j As Long
TextBox5.Text = ""
Dim mail As New Net.Mail.MailMessage()
For j = 1 To ListView1.CheckedItems.Count.ToString
TextBox6.Text = ListView1.CheckedItems(0).ToString
'etc to include all subitems so the entire row is moved
mail.From = New Net.Mail.MailAddress("[email protected]")
error here mail.To.Add(TextBox6.Text)
mail.Subject = TextBox1.Text
mail.Body = TextBox2.Text & vbCrLf & TextBox3.Text
TextBox5.Text = "Email Sent To " & TextBox6.Text
'If TextBox4.Text <> "" Then
mail.Attachments.Add(New System.Net.Mail.Attachment(TextBox4.Text))
'End If
Dim smtp As New Net.Mail.SmtpClient("192.168.101.10")
'smtp.Timeout = 30 * 1000 ' Milliseconds
smtp.Send(mail)
Next j
TextBox5.Text = "Finished"
Re: [2005] The specified e-mail address is currently not supported.
If the specified e-mail address is not supporte4d then we'd obviously have to know what the specified e-mail address is. EXACTLY what does TextBox6.Text contain?
Re: [2005] The specified e-mail address is currently not supported.
listviw1 has a list of email address that are checked textbox6 = the first checked item in listview1. which is a vailed email address
TextBox6.Text = "ListViewItem: {[email protected]}"
Re: [2005] The specified e-mail address is currently not supported.
straight from the msdn documentation
Quote:
MailMessage..::.To Property
The To property is used to designate the addresses on the To line of an e-mail message. To add a recipient to an e-mail message, create a MailAddress for the recipient's address, and then add that object to the collection returned by this property
Review your mailmessage.to statement
Re: [2005] The specified e-mail address is currently not supported.
Quote:
Originally Posted by computerguy46
listviw1 has a list of email address that are checked textbox6 = the first checked item in listview1. which is a vailed email address
TextBox6.Text = "ListViewItem: {
[email protected]}"
Ask yourself this: if you typed "ListViewItem: {[email protected]}" into the address field of a new message in your own e-mail client, would you expect it to get through? Does that look like a valid e-mail address to you?
Re: [2005] The specified e-mail address is currently not supported.
i fixed the problem "ListViewItem: {[email protected]}" i had to make a code change to take out the ListViewItem: {} part of the string thanks for your help
Re: [Resolved][2005] The specified e-mail address is currently not supported.
I think you'll find that you've gone the long way around. How did that value get into the TextBox in the first place? I'll wager that at some point you've assign a ListViewItem to the Text property of the TextBox, e.g.
vb.net Code:
myTextBox.Text = myListViewItem
That will implicitly call the ListViewItem's ToString method, which produces the result you're seeing. What you should have been doing was getting the Text property of the ListViewItem, NOT the ListViewItem itself, e.g.
vb.net Code:
myTextBox.Text = myListViewItem.Text