Hello everyone,

I have this code below and everytime I run it I get this error.

Please help.

Private Sub SendEmail(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
        Email.To.Add(Settings.txtTo.Text)
        Email.From = New MailAddress(Settings.txtFrom.Text)
        Email.Body = "Email Body"
        Email.Subject = "Email Subject"

        SMTPServer.Host = Settings.txtSMTPServer.Text
        SMTPServer.Credentials = Authentication

        SMTPServer.Send(Email)
    End Sub

The error I get is: The parameter 'addresses' cannot be an empty string. Parameter name: addresses
And it's pointing to the Email.To.Add() section.

I thought the code would be pretty simple since I have text boxes in another form and I have linked to them before.

Thanks in advance for the help,

P.S. I've searched forums all over for help and haven't found anything that seems to help so I appreciate anything you can give me.

Is this using the CHILKAT library?

if so, the address add command has to parts:
name, email
if you do not want to add a name, use the following

Email.To.Add ("", Settings.txtTo.Text)

or replace the "" with a string of your liking.
~Matt

Thank you Matt for the quick reply.

I am new to this VB.NET scene so I'm honestly not sure about the CHILKAT library. I haven't added any library of that kind to the project.

I'm away from my office right now but when I get in in the morning I'll give your suggestion a try.

Thanks,

Matt,
I just tried your suggestion and get an error: "Overload resolution failed because no accessible 'Add' accepts this number of arguments."

Any suggestions?

Thanks,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.