Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send an email with default smtp

Status
Not open for further replies.

trinity85

Programmer
Jun 8, 2005
8
CA
Hello!
I am trying to send an email using the default iis smtp server. The code below works on my machine, but when i installed the application on another machine it gives an error at smtpmail.send. Error is 0x800ccc15 and the message is:
System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available
------------------------------
imports system.web.mail
...
mailMsg.From = <my Email>
mailMsg.To = <another Email>
mailMsg.Subject = <some subject>
mailMsg.Body = < some body>
try
SmtpMail.SmtpServer = "127.0.0.1"
SmtpMail.Send(mailMsg)
catch ex as exception
end try
------------------------------

Can anyone help me? Is there some specific setting that I don't know about?

Thank you!
 
Hi James

I have already looked at that website but none of the suggestions helped. On that website I found someone with the same error code but he had it when trying to send email with attachment only. It didnt occur when sending a simple email so his solution didnt apply to me.

Can anyone else help me tell me what im missing?

....
 
127.0.0.1 always points to the host system; check to make sure you have SMTP installed and running on your box (you can find it listed in the add/remove windows components area under Internet Information Services (IIS)).

Jeff W.
MCSE, CNE
 
Info I found on this a while back.....

In order for CDOSYS to send e-mail or other messages from your application, you need to enlist the services of IIS with the SMTP Service installed. Both are available in Windows 2000/XP through the Control Panel -> Add/Remove Programs -> Add/Remove Windows Components option. The job of the STMP Service is to accept and deliver the messages, based on the configuration. The service can attempt to deliver the messages directly, or it can utilize a smart host to deliver the message instead. When a smart host is enlisted, all messages are forwarded to it for delivery. You need to have IIS and the SMTP service installed and configured.

The SMTP Service uses a directory structure to contain messages prior to delivery. The default directory is C:\Inetpub\mailroot. This folder contains a number of subdirectories such as Queue, Drop, and Badmail. If you are unable to configure your instance of the SMTP Service for delivery, you can find the message in a *.EML file in the C:\Inetpub\mailroot\Queue directory. This technique can be useful when creating messages offline.

Sending a Message
As previously mentioned, sending an e-mail is a relatively simple thing to do. The System.Web.Mail.MailMessage class represents the message to be sent. E-mail messages are constructed by using instances of this class. This class contains properties such as To, From, and Subject that allow you to control the message being sent. Attachments can be created through instances of the System.Web.Mail.MailAttachment and then added to the MailMessage through the Attachments collection of the MailMessage. The message is then delivered through the System.Web.Mail.SmtpMail class.



Sweep
...if it works dont mess with it
 
Thank you for your responses. I have already enabled relaying for my ip address only and it works on this computer! But when i installed it somewhere else it doesnt work there. Both have the smtp server that comes with iis and both have relaying on with the computers ip address...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top