I'm working on a simple web app to send email. Below is my 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
I have added the following code to my webconfig file: - <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?
3 1429
Hi mturner64,
Firstly, you've posted this in the ASP forum which is for Classic ASP only. I'm moved the thread to the .NET forum where you should receive better help.
As for your question, the problem here is probably the connection to your mail host. I'm not 100% sure about this one but you might need to set the Host property of your smtp object before using the Send method.
Also, can you try pinging that host name from the machine which hosts your web pages? It could be a problem with the DNS resolving the name - have you tried using the IP address of your mail server instead?
Dr B
Plater 7,872
Recognized Expert Expert
What errors are you getting? The SMTP server should send you an error code and possibly a short message describing the error.
You need to make sure you have a few things first:
1) Does you email host allow smtp connections?
2) Do you have the correct hostname for the smtp server?
3) Does your SMTP host require authentication to send mail (most do)?
i think you might want to swap these 2 lines -
'Send the MailMessage (will use the Web.config settings)
-
smtp.Send(email)
-
smtp.Host = "mail.se.edu"
and make it -
'Send the MailMessage (will use the Web.config settings)
-
smtp.Host = "mail.se.edu"
-
smtp.Send(email)
though this wouldnt help much as you already speified the settings in the config file
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: James Hong |
last post by:
Help please, I try to sending an email from my html page using the java
applet.
but it give error on most of the PC only very few work, what is the error i
make
the java applet show as below
**********************************
package Celcom.Client;
|
by: StevenBarnes |
last post by:
I need to have some .Net code be able to send Email using my ISP's SMTP
server. I found some articles on how to use the MAIL FROM: and RCPT TO:
commands that you can stream to a tcp connection on port 25 of the mail
server.
Works nice, but I can only send Emails to addresses on the same domain
as mine (I'm me@myhost.net. I can send to you@myhost.net, but not
myfriend@someotherprovider.com). I get a code back from the RCPT TO:
command of...
|
by: Bill |
last post by:
I have searched through the posts for a question like mine but have
only found much more complicated responses.
On single record view of a form I have an email address field. I
merely want to create a button that will email the same message (and
idealy a word attachment) to whatever address is in view on the form
(chances are that I just input it).
For further explanation:
|
by: Charlie |
last post by:
Hi:
I'm working on an e-commerce site. Using the SMTP class, my site sends out
confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought about
wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling this
kind of thing?
Thanks,
|
by: Sehboo |
last post by:
Hi,
I want to write a very very simple mail application which my father can
use (maybe then I will be able to send and receive emails from him).
This application will have a text box, where he will type a message,
and a button. Once he presses this button the application will send an
email to me (my email address will be hardcoded). I don't think that
it can get any simpler.
Problem is that how to send email from standalone machine...
| |
by: Vanessa Lee |
last post by:
Hello,
Is it possible to write a script using CONDTS object to read all emails from
the SMTP IIS "Drop" folder without changing the username and email address
in LogonSMTP? or is there completely another way to do it. Here is what I
want exactly the program to do:
I just want to have one script that will be able to pickup and read all
emails that arrive regardless of the email prefix. For example, I want the
script to read:...
|
by: krishnakant Mane |
last post by:
hello,
I am a bit confused.
I want to make a program that will take some data from a database and
make a string of text. and send it to the respective email id of a
person.
next I also want to send an attachment of a photo along with the email.
I will be required to make this program run on windows xp.
can some one guide me as to how I can achieve this?
what I will need on windows to send emails?
I believe yahoo, gmail, rediff and msn...
|
by: shapper |
last post by:
Hello,
I am trying to send an email using Asp.Net 2.0.
I am getting the following error:
System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The
server response was: No such user here at
System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
|
by: happyse27 |
last post by:
Hi All,
I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it is working for normal email servers, but NOT with gmail server, I am very puzzled still!!)
Codes(item c below) It keeps complaining and logs and codes are below.
a) apache access logs
---------------------------------
127.0.0.1 - - "GET...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |