I'm working on a simple web app to send email. Below is my code:
I have added the following code to my webconfig file:
The error I get is as follows:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 164.58.120.84:2 5
WHAT TO DO?
Code:
Imports System.Net.Mail
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
Dim FromAddress As String = "mturner64@student.se.edu"
'Create the MailMessage instance
Dim email As New System.Net.Mail.MailMessage(FromAddress, ToTextBox.Text)
'Assign the MailMessage's properties
email.Subject = SubjectTextBox.Text
email.Body = BodyTextBox.Text
email.IsBodyHtml = False
'add attachment
email.Attachments.Add(New Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName))
'Create the SmtpClient object
Dim smtp As New SmtpClient
'Send the MailMessage (will use the Web.config settings)
smtp.Send(email)
smtp.Host = "mail.se.edu"
End Sub
Code:
<system.net>
<mailSettings>
<smtp from="mturner64@student.se.edu">
<network host="mail.se.edu"/>
</smtp>
</mailSettings>
</system.net>
The error I get is as follows:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 164.58.120.84:2 5
WHAT TO DO?
Comment