C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Sending Mail Appln Fails thru Asp.net,C#


Posted Date: 13 Jul 2008      Posted By: sachin      Member Level: Silver     Points: 1   Responses: 3



When I'm sending mail thru Asp.net+C# it is showing this message

Mailbox unavailable. The server response was: 5.7.1 Unable to relay for sachin@sbk.com
but my outlook express is configured
what is problem if any one knows plz help it soon it's urgent
i'm testing this appln on standalone system so if any sttings r there plz specify properly

Thanks in advance





Responses

Author: Anjali Sharma    14 Jul 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

hi
//Function which convert URL information as string//Which is used latter to passed as body message.private String readHtmlPage(string url){ String result; WebResponse objResponse; WebRequest objRequest = System.Net.HttpWebRequest.Create(url); objResponse = objRequest.GetResponse(); using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()) ) { result = sr.ReadToEnd(); // Close and clean up the StreamReader sr.Close(); } return result;}//Code for sending webpage as email.private void btnSend_Click(object sender, System.EventArgs e){ //URL is converted into string message. String message=readHtmlPage(txtURL.Text); String mailServer = "192.168.0.10"; //Change with your mail server address. try { MailMessage Mailer = new MailMessage(); Mailer.From = txtFrom.Text; Mailer.To = txtTo.Text; Mailer.Subject = txtSubject.Text; Mailer.Body = message; Mailer.BodyFormat = System.Web.Mail.MailFormat.Html; SmtpMail.Server(mailServer); SmtpMail.Send(Mailer); lblResult.Text = "Page successfully sent!"; } catch(Exception ex) { lblResult.Text = "An error occurred: " + ex.ToString(); }}



Author: Biju    14 Jul 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

Dim objEmail as New MailMessage()
objEmail.To = txtTo.Text
objEmail.From = txtFrom.Text
objEmail.Cc = txtCc.Text
objEmail.Subject = "Test Email"
objEmail.Body = txtName.Text & ", " &txtComments.Text
objEmail.Priority = MailPriority.High
'SmtpMail.SmtpServer = "localhost"
try
SmtpMail.Send(EMail)
Response.Write(Your E-mail has been sent sucessfully - _
Thank You)

catch exc as Exception
Response.Write("Send failure: " + exc.ToString())
End Try



Author: Sreehari    14 Jul 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 6

The Error message clearly says that your web server from which you are sending mails is not configured with SMTP.YOu will first need to configure SMTP in your server.

Now once you have configured this server you can either make this server as the mail sevrver or if you already have another mail server you can make this server to relay through the dedecated server(ie make this server sent mail through the other)

For that you can go to the properties of smtp and configure relay.

Sreehari
www.codeincsharp.com



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Setting Outlook Express For sending mail thru Asp.net+C#
Previous : How to get Pop Up Values to Parent Form
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use