This is a discussion on "asp.net send email problem" within the ASP.NET Forum section. This forum, and the thread "asp.net send email problem are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
asp.net send email problem
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hello
I am using Window Small Business Server and MS Exchange Server act as the SMTP server. I wrote a web application for sending email to others. It works fine in XP, but error appears in the Small Business Server Here is the code: Public Function sendMail(ByVal mailTo As String, ByVal mailFrom As String, ByVal subject As String, ByVal content As String, ByVal priority As String) Dim mail As New MailMessage mail.BodyFormat = MailFormat.Text mail.To = mailTo mail.From = mailFrom mail.Subject = subject mail.Body = content SmtpMail.SmtpServer = "127.0.0.1" SmtpMail.Send(mail) End Function Error Message: Could not access 'CDO.Message' object. Exception has been thrown by the target of an invocation. The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available Please help |
|
|
|
|||
|
Re: asp.net send email problem
Im not a .net pro..... but im actually in the process of learning myself....
But i can see straight away what your problem is.....SmtpMail.SmtpServer = "127.0.0.1"............ you need to specify a path and not an IP address..... I THINK lol Thanks Dan |
|
|||
|
Re: asp.net send email problem
Hi,
ip is OK there, you sure you got smpt server up and running ? |
|
|||
|
Re: asp.net send email problem
Try changing the following line from:
HTH |
|
|||
|
Re: asp.net send email problem
|
|
|||
|
Re: asp.net send email problem
protectedvoid btnSendmail_Click(object sender, EventArgs e)
{ // System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0 // System.Net.Mail.SmtpClient is the alternate class for this in 2.0 SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try { MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text); // You can specify the host name or ipaddress of your server // Default in IIS will be localhost smtpClient.Host = "localhost"; //Default port will be 25 smtpClient.Port = 25; //From address will be given as a MailAddress Object message.From = fromAddress; // To address collection of MailAddress message.To.Add("admin1@yoursite.com"); message.Subject = "Feedback"; // CC and BCC optional // MailAddressCollection class is used to send the email to various users // You can specify Address as new MailAddress("admin1@yoursite.com") message.CC.Add("admin1@yoursite.com"); message.CC.Add("admin2@yoursite.com"); // You can specify Address directly as string message.Bcc.Add(new MailAddress("admin3@yoursite.com")); message.Bcc.Add(new MailAddress("admin4@yoursite.com")); //Body can be Html or text format //Specify true if it is html message message.IsBodyHtml = false; // Message body content message.Body = txtMessage.Text; // Send SMTP mail smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lblStatus.Text = "Send Email Failed.<br>" + ex.Message; } try this code Srikanth Areteinfotech |
![]() |
| Tags |
| aspnet, send, email, problem |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to send email to user? | LegolasV | JavaScript Forum | 1 | Jun 5th, 2008 09:16 |
| Please help me send an Email template. | Oak | Web Page Design | 5 | May 20th, 2008 07:37 |
| PHP Form send in email | Bravo81 | PHP Forum | 20 | Jan 17th, 2008 11:47 |
| Form won't send to email? | Inkers | Web Page Design | 3 | Jan 22nd, 2007 16:11 |
| how to send email in php | manzil | PHP Forum | 1 | Jul 30th, 2006 16:34 |