• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

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

Hi,

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:

http://www.cebdata.com/FTPSupport.aspx

..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("paggarwala@cebdata.com", "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 = "smtp.cebdata.com"
 
        Try
            mailSender.Send(formmail)
            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

FTPSupport.zip
0
piyushdabomb
Asked:
piyushdabomb
  • 5
  • 4
1 Solution
 
jjardineCommented:
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.
0
 
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!
0
 
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.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
jjardineCommented:
If I run the code it says that the remote name cannot be resolved   "smtp.cebdata.com'    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.
0
 
piyushdabombAuthor Commented:
Can I ask you try your own and check to see if it works for you?
0
 
jjardineCommented:
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?
0
 
piyushdabombAuthor Commented:
Hmm...

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

How would I incorporate my username and password to this code?
0
 
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"?
0
 
jjardineCommented:
you could probably loop through Form.controls or page.controls collection to grab the values?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now