Sending my Form to my Inbox (...with a potential attachment) using VB.NET !


I've spent HOURS trying to get my form details to get send out to my inbox at work but I'm not able to. I can't send mail to my inbox regardless of what is in my form.

Can someone PLEASE PLEASE help me out here? The form is located at:

..and enclosed are the .aspx files and images (NOTE: rename the .doc file to .aspx - otherwise I couldn't upload it) document.

Your help is very very much appreciated. I don't know why but here is what I get out of this aspx page:

> I press the 'submit' button and no errors.
> I'm using Visual Web Dev Express and I don't see any squigly lines under my code

To find my code, here is a small snippet of the function I'm using after the user presses "Submit"

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim fromAddress As New Net.Mail.MailAddress("", "FTP Support!")
        Dim toAddress As New Net.Mail.MailAddress("paggarwala@executiveboard", "FTP Support!")
        Dim formmail As New Net.Mail.MailMessage(fromAddress, toAddress)
        With formmail
            .Subject = "<b> Testing new email</b>"
            .Body = "Testing new email, sent at " & DateTime.Now.ToString()
            .IsBodyHtml = True
        End With
        Dim mailSender As New System.Net.Mail.SmtpClient()
        mailSender.Host = ""
            Console.WriteLine("Successfully sent email message" + vbCrLf)
        Catch err As Exception
            Console.WriteLine("EXCEPTION " + err.Message + vbCrLf)
        End Try
    End Sub

Open in new window
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Just looking at the code posted, you don't have a valid To Address in the field.  You are missing the .com or .net when you create your toAddress.  

Also, if this is a webform use Response.write  to write the errors to your page instead of using console.writeline   to ease the debugging.
piyushdabombAuthor Commented:
So I added the .com at the end of the toaddress and NOTHING, zip!

Where am I oging wrong with this? please help!
piyushdabombAuthor Commented:
In addition, can I request you to attempt trying out the attached code with your personal informaiton and check to see if you're receiving any mail? If you are, then its a likely issue with my settings. Let me know! Thank you.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

If I run the code it says that the remote name cannot be resolved   "'    This would lead me to believe that the smtp record does not exist in dns.   Probably only an internal record so outside the company people can't get to it.
piyushdabombAuthor Commented:
Can I ask you try your own and check to see if it works for you?
I don't have an smtp server that is available for me to try.  Are you able to ping that smtp address?  can you see it from your location?  Does it require any authorization?   who controls the smtp server?
piyushdabombAuthor Commented:

I can't seem to ping to it. I found out the that host is "" and my username and password is something as well.

How would I incorporate my username and password to this code?
piyushdabombAuthor Commented:
Alright... so I am able to successfully send out emails now. I changed my webconfig file with the right details.

I'm going to switch topics but its still somewhat similar. Here it goes:

> I have a form and I want to email the entire form to myself. How can I email the form WITHOUT constantly referencing each object name in my procedure? Is there a way to somehow save the entire form and its results to a document and send it nicely to me or even paste it in my email account so I can read it "nicely"?
you could probably loop through Form.controls or page.controls collection to grab the values?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.