dcsimg
Results 1 to 10 of 10

Thread: Send mail to a email that has been entered in a text box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    28

    Question Send mail to a email that has been entered in a text box

    Ok Guys i need help how can i get this to work :
    Code:
            Dim text As String
            text = TextBox1.Text & TextBox2.Text + vbLf
            Dim myClient As New Net.Mail.SmtpClient("smtp.web.de")
            myClient.Credentials = New NetworkCredential(Form2.TextBox2.Text, Form2.TextBox3.Text)
            myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, , "test", text)
    so i want to send it to a mail adress that hasnt been declared and that you have to enter first .... it says me that VB cant handle it.... can u help me please ?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Send mail to a email that has been entered in a text box

    In all the years, and all the versions, of my VB experience I have never seen an error message that said "VB Can't handle it."

    Could you give us the exact wording of the error message please?

    Also, is it happening on the "myClient.Send" line or somewhere else?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    28

    Re: Send mail to a email that has been entered in a text box

    Quote Originally Posted by Hack View Post
    In all the years, and all the versions, of my VB experience I have never seen an error message that said "VB Can't handle it."

    Could you give us the exact wording of the error message please?

    Also, is it happening on the "myClient.Send" line or somewhere else?
    I think its a bit difficult cause my version isnt english ....
    i tried with google translator and its in the last line !
    so heres the translation
    Error when overload resolution, because no accessible "Send" accepts this number of arguments

    or somethign like that

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Re: Send mail to a email that has been entered in a text box

    Remove the empty argument from your parameter list. That is:
    Code:
    'change this:
     myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, , "test", text)
    'to this
     myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, "test", text)
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    28

    Re: Send mail to a email that has been entered in a text box

    Quote Originally Posted by stanav View Post
    Remove the empty argument from your parameter list. That is:
    Code:
    'change this:
     myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, , "test", text)
    'to this
     myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, "test", text)
    no dude in that there is something missing
    what can i do to fix that freakin Error !

  6. #6
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: Send mail to a email that has been entered in a text box

    If you look at the documentation, you'll see there's two overloads. One takes a MailMessage parameter, the other takes four strings. If you provide any other combination of parameters, VB .NET doesn't have a method to call and will complain.

    You're trying to use the one that takes four strings. You're providing five strings and an empty argument. That's not going to work. stanav is trying to tell you this. There can't be something missing in your blank space because there is no Send() that takes five parameters. stanav's suggestion is correct.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    28

    Re: Send mail to a email that has been entered in a text box

    Quote Originally Posted by Sitten Spynne View Post
    If you look at the documentation, you'll see there's two overloads. One takes a MailMessage parameter, the other takes four strings. If you provide any other combination of parameters, VB .NET doesn't have a method to call and will complain.

    You're trying to use the one that takes four strings. You're providing five strings and an empty argument. That's not going to work. stanav is trying to tell you this. There can't be something missing in your blank space because there is no Send() that takes five parameters. stanav's suggestion is correct.
    But stanavs suggestion doesnt work , cause VB tells me if i use his code that something is missing

  8. #8
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: Send mail to a email that has been entered in a text box

    I understand that it's difficult to translate the error, but if we don't know the exact error message it's hard to help. Nothing can be missing because you have provided four parameters. Let's try going back to your description and figuring out what's going on:
    Error when overload resolution, because no accessible "Send" accepts this number of arguments
    OK, that's strange. That would indicate that no available overloads take four arguments. But we just looked at documentation that says you need one or four. Either you did not type the code properly or you aren't telling us the right error message. Make sure you didn't include all of stanav's code; you were supposed to change your line that matches his first line to the second line. In other words, delete your "myClient.Send(..." line and replace it with this:
    Code:
    myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, "test", text)
    If that doesn't work, something strange is going on and it might take more of your code to decide what is causing the problem.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    28

    Re: Send mail to a email that has been entered in a text box

    Quote Originally Posted by Sitten Spynne View Post
    I understand that it's difficult to translate the error, but if we don't know the exact error message it's hard to help. Nothing can be missing because you have provided four parameters. Let's try going back to your description and figuring out what's going on:

    OK, that's strange. That would indicate that no available overloads take four arguments. But we just looked at documentation that says you need one or four. Either you did not type the code properly or you aren't telling us the right error message. Make sure you didn't include all of stanav's code; you were supposed to change your line that matches his first line to the second line. In other words, delete your "myClient.Send(..." line and replace it with this:
    Code:
    myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, "test", text)
    If that doesn't work, something strange is going on and it might take more of your code to decide what is causing the problem.
    OK so i will try what i can and if it still doesnt work i might make a video

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    28

    Re: Send mail to a email that has been entered in a text box

    Quote Originally Posted by Sitten Spynne View Post
    I understand that it's difficult to translate the error, but if we don't know the exact error message it's hard to help. Nothing can be missing because you have provided four parameters. Let's try going back to your description and figuring out what's going on:

    OK, that's strange. That would indicate that no available overloads take four arguments. But we just looked at documentation that says you need one or four. Either you did not type the code properly or you aren't telling us the right error message. Make sure you didn't include all of stanav's code; you were supposed to change your line that matches his first line to the second line. In other words, delete your "myClient.Send(..." line and replace it with this:
    Code:
    myClient.Send(Form2.TextBox2.Text, Form2.TextBox2.Text, "test", text)
    If that doesn't work, something strange is going on and it might take more of your code to decide what is causing the problem.
    DUDe nevermind i did something wrong ! it was my fault sry

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width