How to send email using smtp server.(Problem) 
Author Message
 How to send email using smtp server.(Problem)

hi,
i want to send email using C# .
i having me using this code but ima getting a error
error:could not create Cdonts object ?
will this code work only on asp.net pages or what?
i want to send message from a client M/c.
using System;
using System.Web;      

class mail
{
        public static void Main()
        {
                System.Web.Mail.MailMessage Message = new
System.Web.Mail.MailMessage();


                Message.Body = "Test message text";
                Message.Subject = "A Test";

                System.Web.Mail.SmtpMail.SmtpServer = "infomail";
                System.Web.Mail.SmtpMail.Send(Message);

                //Console.WriteLine("Sent");
        }

Quote:
}

the code give a error on the send command woill please tell me whats
the problem with the code.


Mon, 01 Nov 2004 20:58:32 GMT  
 How to send email using smtp server.(Problem)
Navin,

    Install outlook on the machine in question.  The SMTP classed are based
on the CDO COM objects for their functionality.  I don't know if there is a
distributable for this, but you might want to check first.  If not, you can
always install Outlook.

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> hi,
> i want to send email using c# .
> i having me using this code but ima getting a error
> error:could not create Cdonts object ?
> will this code work only on asp.net pages or what?
> i want to send message from a client M/c.
> using System;
> using System.Web;

> class mail
> {
> public static void Main()
> {
> System.Web.Mail.MailMessage Message = new
> System.Web.Mail.MailMessage();


> Message.Body = "Test message text";
> Message.Subject = "A Test";

> System.Web.Mail.SmtpMail.SmtpServer = "infomail";
> System.Web.Mail.SmtpMail.Send(Message);

> //Console.WriteLine("Sent");
> }
> }
> the code give a error on the send command woill please tell me whats
> the problem with the code.



Mon, 01 Nov 2004 21:01:43 GMT  
 How to send email using smtp server.(Problem)

Quote:
>i want to send email using c# .
>i having me using this code but ima getting a error
>error:could not create Cdonts object ?

What operating system are you using?  As indicated by the MSDN .NET
documentation, the classes in the System.Web namespace require Windows
2000/XP Pro/.NET Server, so Windows 98/Me/XP Home won't work.

You *might* get by with an installation of Outlook or Exchange, as
Nicholas suggested, but I think System.Web relies on CDOSYS.DLL
version 6.0 which is only supplied with the above-mentioned operating
sytems, according to MSDN Knowledge Base article Q171440.

The CDO library is definitely not available as a redistributable
component, by the way, according the same article.



Tue, 02 Nov 2004 00:15:16 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to send email without smtp server.

2. Send and receive e-mails using SMTP Server

3. Send SMTP Email _WITHOUT IIS_?

4. how to send an Email via SMTP (with attached file)

5. How to send and get email via SMTP ?

6. Help with Sending E-mail with SMTP server

7. SMTP Sample code (was: Code for sending an e-mail message to a pop3 server)

8. SMTP Sample code (was: Code for sending an e-mail message to a pop3 server)

9. Send mail using SMTP and File Attach.

10. Sending file attachments using SMTP

11. Unable to send mails using SMTP

12. Using Winsock to send Emails

 

 
Powered by phpBB® Forum Software