locked
What's wrong with this code? RRS feed

  • Question

  • User1441073843 posted

    Hi

     I have a wizard that a user fills out and the info they input in the text boxes get sent to me to work with (Requesting A user account on my website) but it doesn't work. The code is below:

    Private Sub SendMail(ByVal from As String, ByVal body As String)

    Dim mailServerName As String = "SMTP.jacobsaunders.cjb.in"
    Dim message As MailMessage = New MailMessage(from, "jacobsaunders93@gmail.com", "User Account Request", body)
    Dim mailClient As SmtpClient = New SmtpClient

    mailClient.Host = mailServerName
    mailClient.Send(message)
    message.Dispose()

    End Sub

    It highlights "message As MailMessage = New MailMessage(from, "jacobsaunders93@gmail.com", "User Account Request", body)" and says "The specified string is not in the form required for an e-mail address."

    Can you please help me fix this?!

     Thanks

    Jacob Saunders
     

    Saturday, October 24, 2009 4:32 PM

Answers

  • User-1155992655 posted

    I can't see anything wrong with the code.  Are you sure the 'from' string is an email address?



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 25, 2009 2:23 AM
  • User-744022866 posted

    what is the content of the variable "from". is it in email format...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 25, 2009 2:25 AM

All replies

  • User-1155992655 posted

    I can't see anything wrong with the code.  Are you sure the 'from' string is an email address?



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 25, 2009 2:23 AM
  • User-744022866 posted

    what is the content of the variable "from". is it in email format...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 25, 2009 2:25 AM