Quantcast
Channel: General
Viewing all articles
Browse latest Browse all 7363

SMTP credentials?

$
0
0

Hello

I am trying to set up a Web email contact form and wish to test it against the local IIS Express server that comes with Visual Studio 2013. My form looks like this:

 Protected Sub btnSubmit_Click1(sender As Object, e As EventArgs)

        'Protected Sub btnSubmit_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit_Click1.Click

        Dim mail As New MailMessage()
        mail.To.Add(email.Text)
        mail.From = New MailAddress("info@mySite.net")
        mail.Subject = "Contact Form"
        'mail.Bcc = New MailAddress
        mail.Body = name.Text & vbCrLf & message.Text

        Dim smtp As New SmtpClient("mail.server")
        smtp.Credentials = New NetworkCredential("EMAIL ID", "PWD")

        smtp.Send(mail)
        Label1.Text = "Thank you " & email.Text
        Label1.Attributes.Add("style", "display:block")
        lblStatus.Text = "Your data has been submitted successfully"
        name.Text = ""
        email.Text = ""
        message.Text = ""
    End Sub
End Class

When I complete and submit the form, I get this:

SMTP error

What SMTP credentials should I be using, please? Is there a generic password? In Classic ASP, I would usually use something like:

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = youremail
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourpassword

and you can create an attractive HTML form for the user:

 strBody = strBody & "<font face=""Arial"">Contact bayingwolf form submitted at " & Now() &  vbCrLf & "<br><br>"
	strBody = strBody & "<b>From</b> http://" & Request.ServerVariables("HTTP_HOST") &  vbCrLf & "<br><br>"
	strBody = strBody & "<b>IP</b> " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "<br><br>"
	strBody = strBody & "<b>Name</b>" & " : " & " " & Replace(ContactUs_Name,vbCr,"<br>") & "<br><br>"
	strBody = strBody & "<b>Email</b>" & " : " & " " & Replace(ContactUs_Email,vbCr,"<br>") & "<br><br>"
	strBody = strBody & "<br>" & Replace(ContactUs_Body,vbCr,"<br>") & "<br><br>"
	strBody = strBody & "</font>"
	Dim ObjSendMail
	Set ObjSendMail = CreateObject("CDO.Message") 

There is nothing like that in my contact.aspx.vb file - only what I have posted above.

Thanks for any advice.


Viewing all articles
Browse latest Browse all 7363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>