asp.net send email problem

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > ASP.NET Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 24th, 2006, 08:40
New Member
Join Date: Aug 2006
Location: HK
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy asp.net send email problem

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
Reply With Quote

  #2 (permalink)  
Old Aug 30th, 2006, 11:21
New Member
Join Date: Aug 2006
Location: East Sussex, England
Age: 22
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #3 (permalink)  
Old Sep 4th, 2006, 11:05
New Member
Join Date: Sep 2006
Location: il
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: asp.net send email problem

Hi,
ip is OK there, you sure you got smpt server up and running ?
Reply With Quote
  #4 (permalink)  
Old Sep 5th, 2006, 09:23
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Re: asp.net send email problem

Try changing the following line from:
Code: Select all
mail.BodyFormat = MailFormat.Text
to
Code: Select all
mail.BodyFormat = Mail.MailFormat.HTML ' for HTML formatted email
or
Code: Select all
mail.BodyFormat = Nothing ' for plaintext or just comment out
If the users are selecting the mail format, use a dropdown or radio in your presentation and then in your codebehind use a "select case" or "if.. else.." to handle the condition.

HTH
Reply With Quote
  #5 (permalink)  
Old Sep 9th, 2006, 09:17
New Member
Join Date: Sep 2006
Location: India
Age: 30
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: asp.net send email problem

I think the above format would work well try it...........

India Software Development
Reply With Quote
  #6 (permalink)  
Old Sep 12th, 2006, 10:31
New Member
Join Date: Sep 2006
Location: mumbai
Age: 28
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
Reply

Tags
aspnet, send, email, problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 00:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43