Sending email

F

flowergardener

I am learning ASP.NET from the book, "ASP.NET for Dummies". An example for
sending email using SMTP fails on my PC. What does this error mean and how
to fix it.

I am running Windows XP and I have Outlook Express which I assume has
installed SMTP in order to work.

The error screen is:
______________________________________________________________________
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid.

Source Error:

Line 13: "important about this message at all."
Line 14:
Line 15: SmtpMail.Send(EMailFrom, EMailTo, EMailSubject, EMailBody)
Line 16: %>
Line 17: </body>

______________________________________________________

This is the code example:

<%@Page Explicit="True" Language="VB" Debug="True" %>
<%@Import Namespace="System.Web.Mail" %>
<html>
<body>
<%
Dim EMailTo As String = "(e-mail address removed)"
Dim EMailFrom As String = "(e-mail address removed)"
Dim EMailSubject As String = "Important message!"
Dim EmailBody As String

EmailBody = "Thanks for reading this message. " & _
"But I must admit, I lied. There's nothing " & _
"important about this message at all."

SmtpMail.Send(EMailFrom, EMailTo, EMailSubject, EMailBody)
%>
</body>
</html>
 
A

Andrew de la Harpe

Outlook is not a SMTP server.
Use your ISP's SMTP server to send e-mail and it should work.
A
 
J

JPL

Outlook Express can send mail messages via SMTP, but it is
not the same as an SMTP server.

Given that you have not set the SmtpServer property of the
SmtpMail object, it will fail as it will attempt to use
the local host.

You can install the SMTP server through add/remove
programs (Windows Components) on Win2K/WinXP/Win2003.

Kind Regards,
JPL
-----Original Message-----
I am learning ASP.NET from the book, "ASP.NET for Dummies". An example for
sending email using SMTP fails on my PC. What does this error mean and how
to fix it.

I am running Windows XP and I have Outlook Express which I assume has
installed SMTP in order to work.

The error screen is:
__________________________________________________________ ____________
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details:
System.Runtime.InteropServices.COMException: The
 
F

flowergardener

Which title in the Components menu is the SMTP server? I don't see anything
entry that specifically says SMTP. I have everything installed except for:
Fax Services
Message Queuing
Universal Plug and Play
Other Network File and Print Services
Windows Messenger

If the server is installed, how do I set the SmtpServer property? Where
would I find it?
 
F

flowergardener

I don't understand how to do that. What statements do I put into my code
example to reach my ISP's SMTP server?
 
F

flowergardener

Thanks to all for your helpful instructions. By adding two lines to my
example, I got it working. I needed the server object and the address of my
ISP.

<%@Page Explicit="True" Language="VB" Debug="True" %>
<%@Import Namespace="System.Web.Mail" %>
<html>
<body>
<%
Dim aEmail As New System.Web.Mail.MailMessage
Dim aMessage As System.Web.Mail.SmtpMail
Dim aEMailTo As String = "(e-mail address removed)"
Dim aEMailFrom As String = "(e-mail address removed)"
Dim aEMailSubject As String = "Important message!"
Dim aEmailBody As String

aMessage.SmtpServer = "mail.optonline.net"

aEmailBody = "Thanks for reading this message. " & _
"But I must admit, I lied. There's nothing " & _
"important about this message at all."

SmtpMail.Send(aEMailFrom, aEMailTo, aEMailSubject,

aEMailBody)
%>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top