C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




problem in Sending email in asp.net


Posted Date: 22 Nov 2008      Total Responses: 1

Posted By: guddu       Member Level: Silver     Points: 1



hi have created email application in asp.net 2.0
it works fine but it only sent mail to gmail
not any oother like rediff or yahoo
im sending code
thnk u
protected void btnMail_Click(object sender, EventArgs e)
{
if (txtFrom.Text.Trim() == "")
{
lblResult.Text = "Please Enter E-mail from address.";
}
else if (txtTo.Text.Trim() == "")
{
lblResult.Text = "Please Enter E-mail to address.";
}
else if (txtSubject.Text.Trim() == "")
{
lblResult.Text = "Please Enter the subject.";
}
//else if (txtMessage.Text.Trim() == "")
//{
// lblResult.Text = "Please Enter The message";
//}
else if (FreeTextBox1.Text=="")
{
lblResult.Text = "please enter The Message";
}
try
{
MailMessage msg = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, FreeTextBox1.Text);
msg.IsBodyHtml = true;
//if (fileUpload.PostedFile.FileName == "")
//{

//}
//else
//{
// msg.Attachments.Add(new System.Net.Mail.Attachment(fileUpload.PostedFile.FileName));
// //msg.Attachments.Add(Attachment(fileUpload.PostedFile.FileName));
//}
SmtpClient mySmtp = new SmtpClient("192.168.0.249");

mySmtp.Send(msg);
lblResult.Text = "Message Sent";
}
catch(Exception ex)
{
lblResult.Text = ex.Message;
}

}





Responses

Author: Pradnya    22 Nov 2008Member Level: SilverRating:     Points: 1

The mail must have sent but with yohoo or rediff it might be sent as junk mail.


Post Reply
You must Sign In to post a response.
Next : How to alort a message when user not selected any checkbox.?
Previous : How to count the number of checkboxes that are checked by user?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use