473,378 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problem in sending mail using SMTP

Hi all
I have a problem in sending an email through my web application.
I have created my own web application and trying to send mail through this appl.but unable to send it to the reciepent.
The code written by me is-----------

Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2.     {   
  3.         MailMessage theMailMessage = new MailMessage("****_munged__@yahoo.co.in", "__**__@gmail.com");
  4.         theMailMessage.Body = "body email message here Hiiiiiiiiiiiii";
  5.         //theMailMessage.Attachments.Add(new Attachment("pathToEmailAttachment"));
  6.         theMailMessage.Subject = "Subject Of my Message here";
  7.  
  8.         SmtpClient theClient = new SmtpClient("192.146.1.2");
  9.         theClient.UseDefaultCredentials = true;
  10.         System.Net.NetworkCredential theCredential = new System.Net.NetworkCredential("*******@yahoo.co.in", "anusuya");
  11.         theClient.Credentials = theCredential;
  12.         try
  13.         {
  14.             theClient.Send(theMailMessage);
  15.             Label1.Text = "Msg Send...";
  16.         }
  17.         catch (Exception ex)
  18.         {
  19.             Label1.Text = "msg Not Send....";
  20.         }
  21.     }
If anyone can help me he/she is most welcome........
Nov 11 '08 #1
1 891
kenobewan
4,871 Expert 4TB
Write the exception ex and report on error message.
Nov 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on...
7
by: Santosh | last post by:
Dear all, i am wrtiing following code for the sending email from the my asp application when i am working on the local machine i will work fine ans send email on the mentioned address. but when i...
2
by: softbreeze | last post by:
Operating systems: Windows 2003 Enterprise ASP.Net 2.0, IIS 6.0, *** SMTP is not installed *** I have a corporate network that has an SMTP server (10.254.3.30) on it. I have a subnet (10.5.42.0)...
0
Dormilich
by: Dormilich | last post by:
this is a follow-up thread to this one. http://bytes.com/topic/html-css/answers/863662-form-not-submitted-sometimes I figured out that the mail sending class triggers the described error....
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.