Entry
Visual Basic.net: ASP.net: E-mail: Smtp: Simple: Send: How to send an e-mail?
Feb 26th, 2004 11:58
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 23 December 2003 - 00:26 am -------------------
Visual Basic.net: ASP.net: E-mail: Smtp: Simple: Send: How to send an
e-mail?
---
Steps: Overview:
1. -Start Visual Studio
2. -Create a new Visual Basic ASP.net application
3. -Possibly change the name and the location
of the project
Location default = http://localhost
I changed the name to 'emailsend'
4. -Click on the left side on 'Toolbox'
5. -Single click button 'Web Forms'
6. -Double click on a button component
7. -Double click on this button on the form
8. -On top of the text add the following line:
Imports System.Web.Mail
9. -Double click on the button
10. -Beneat the Button1_Click() code, fill in:
SmtpMail.SmtpServer = "<some smtp server which allows you to send
e-mail via it>"
SmtpMail.Send
( "infofrom@mydomain.com","infoto@anotherdomain.com","Thank You", "We
look forward to working with you again in the future")
11. -In general this becomes
SmtpMail.SmtpServer = "<some smtp server which allows you to
send e-mail via it>"
SmtpMail.Send( "<from e-mail address>","<to e-mail
address>", "<your e-mail subject text>", "<your e-mail body text>" )
11. -Possibly save your code (e.g. press <CTRL><S>)
12. -Compile the source code
(e.g. press <F5>)
13. -Click on the button to send the e-mail
---
---
Trouble shooting:
Typical error messages:
The server rejected the sender address. The server response was: 530
authentication required
The server rejected one or more recipient addresses. The server
response was: 554 <yourname@yourprovider.com>: Relay access denied
[COMException (0x80040213): The transport failed to connect to the
server.
[COMException (0x80040220): The "SendUsing" configuration value is
invalid.
should indicate that the SMTP server used does not accept sending
e-mail via it.
---
Possible solution for testing purposes:
---
Change or try another SMTP server address (e.g. smtp.mydomain.com)
---
For example:
use the SMTP server of your provider, and use as
for testing purposes e.g. the
'from' email address your own email address
and as
'to' email address also your own same email address
---
---
Internet: see also:
---
Microsoft: .NET: Visual Studio: Visual Basic.net: Program: Create: How
to create an asp.net program?
http://www.faqts.com/knowledge_base/view.phtml/aid/27279/fid/176
----------------------------------------------------------------------