Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Online Members
Ultimaterengan
Prabu
Sankar
anil kumar prathipati
naveensanagasetti
srinivasan
Prasad kulkarni
More...
Forums
»
.NET
»
.NET
»
Hi I have written small code for sending mail using smtp server in ASP.NET With C# Using
Posted Date:
18 Nov 2009
Posted By::
durga
Member Level:
Bronze
Member Rank:
4130
Points
: 1
Responses:
4
Hi
I have written small code for sending mail using smtp server in ASP.NET With C#
Using my code mail is going with in company only.outside domains(gmail,yahoo...)it is not going..
Any option to sending mail to outside domains also?
here i attached my code
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 = d;
//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(txtEmail.Text);
message.Subject = "Feedback";
//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;
}
Please helps me out
Thanks
durga.
Tweet
Responses
#443993 Author:
venkatesan.M
Member Level:
Gold
Member Rank:
30
Date: 18/Nov/2009 Rating:
Points
: 2
Your MailServer was not allowed to send email to other id or any
you can send only your companymail , due to restriction on your main server.
Regards,
M.Venkatesan.
For Interview Question and Answers:
http://dotnet-interview-qa.blogspot.com
http://venkatdotnetexperiments.wordpress.com
Dot Net Code Snippets
#443994 Author:
Mohan
Member Level:
Gold
Member Rank:
102
Date: 18/Nov/2009 Rating:
Points
: 2
It may be your given smtp server restrict these options.
Regards
Mohan Kumar.D
#443998 Author:
HimaBindu Vejella
Member Level:
Gold
Member Rank:
42
Date: 18/Nov/2009 Rating:
Points
: 2
may be your SMTP/ Firewall is restricting that
http://himabinduvejella.blogspot.com
http://sysntaxhelp.com/asp.net
http://groups.google.com/group/mugh
Hima's Tech Blog
#444149 Author:
Gaurav Arora
Member Level:
Gold
Member Rank:
32
Date: 18/Nov/2009 Rating:
Points
: 2
Check your company's network guys and go through firewall restrictions.
Thanks & regards,
Gaurav Arora -
Lead Editor
My Portal - http://msdotnetheaven.com
Nangal Dam - http://mynangal.com
Me in My Own Style
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
.
Tweet
Next :
What is Abstract factory Method in Design Pattern (.NET)
Previous :
Exam 70-536
Return to Discussion Forum
Post New Message
Category:
Related Messages
Is there any expert to solve this?
what is difference between String and string(data type) in c#?
what is a resource file...
Horizontal Scroll Bar for a listview control
sql querry
Active Members
Today
naveensanagase...
(58)
Pawan Awasthi
(50)
baskar
(38)
Last 7 Days
naveensanagase...
(261)
baskar
(207)
Pawan Awasthi
(194)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
Talk to Webmaster Tony John