Hi every body
i am trying to use mail in my form i have a form name as order form i am taking all the values from the form and i create body of the mail i add from,to,and subject and body to the mail but when i try to send the mail i got some error and i make changes in web.config file also please any one can tell me what are the exact field i have to use in web.config file i will show you what i write in config file
<system.net>
<mailSettings>
<smtp from="">
<network host="" port="3535" userName="" password="" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
please tell me what i have to write in from=
and in host=
i am very much confused with this please help me its very urgent
Loading

Kirtan PatelRank #292 · 8.6K reputationPosted Aug 5, 2009, 5:31 AM EDT
and For Sending Mail used Following code Successfully Worked With Gmail Server
system.net> mailSettings> smtp deliveryMethod="Network"> network host="smtp.gmail.com" port="587" defaultCredentials="false" userName="[email protected]" password="mypass"/> smtp> mailSettings> system.net>And Code used to Send mail is Below
using System.Net.Mail; SmtpClient sc = new SmtpClient(); sc.EnableSsl = true; MailMessage mail = new MailMessage(new MailAddress("[email protected]"), new MailAddress("[email protected]")); mail.Subject = "Testing "; mail.Body = "Hello This IS Testing "; sc.Send(mail); Response.Write("Mail Sent Successfully !!");Roei BarRank #1,271 · 1.4K reputationPosted Aug 5, 2009, 3:42 AM EDT
mohdazeemuddin ahmed125 reputationPosted Aug 5, 2009, 3:50 AM EDT
i type nslookup on the command prompt as you set i got some message that
Cannot find server name for ip address 192.168.56.200:non existent domain
Default server:some name
address: some ip address
i got the above information
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 5, 2009, 4:02 AM EDT
configuration> system.net> mailSettings> smtp deliveryMethod="Network"> network host="yoursmtpserver.com" port="25" defaultCredentials="false" userName="login" password="password" /> smtp> mailSettings> system.net> configuration>Happy Coding :)
mohdazeemuddin ahmed125 reputationPosted Aug 5, 2009, 5:15 AM EDT
I made the setting in web.config as you said i didn't get any error but i didn't received any mail what will be the problem
mohdazeemuddin ahmed125 reputationPosted Aug 5, 2009, 5:40 AM EDT
is it necessary to enable ssl without ssl we can't do
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 5, 2009, 5:53 AM EDT
as Majority Mail Services like Gmail uses ssl so have to make this option enable .
Happy Coding :)
mohdazeemuddin ahmed125 reputationPosted Aug 6, 2009, 12:17 AM EDT
i make ssl enable but its not working on server
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 6, 2009, 12:32 AM EDT
Check Port No if you are using smtp.gmail.com server then Check the port in Web.Config
Port = "587"
and in Username =your gmail whole email Address like "[email protected]"
and in password = your gmail account password
and Be also make Sure that you have enabled POP support in your Gmail account
if you not have enabled POP in gmail account
Do it
1. Login to your gmail account
2. Click on Settings
3. go to Forwarding and POP/IMAP tab
4.Select radio button "Enable POP for all mail"
Thanks
Happy Coding :)
Posted Aug 6, 2009, 11:15 PM EDT
Not all fields are mandatory in web.config. Please find below code you need to update in web.config and ur application.
Web.config:
<system.net>
<mailSettings>
<smtp>
<network host="host server name" port="25" defaultCredentials="true"/>
smtp>
mailSettings>
system.net>
Application:
SmtpClient smtp = new SmtpClient();
smtp.UseDefaultCredentials = true;
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add( new MailAddress( ToemailAdresss,
ToDisplayname);
//create the mail message
mailMessage.Subject = subject;
mailMessage.Body = messageBody;
mailMessage.From = new MailAddress( fromEmailAddress,
fromDisplayName );
smtp.Send( mailMessage );
for above to work please add
System.Net and System.Net.Mail namespaces.
Please mark this post as anwer if this is helpful.
Happy Coding!!
Wizkid
mohdazeemuddin ahmed125 reputationPosted Aug 7, 2009, 10:53 PM EDT
i tried all possible way but i am not getting email the same code working on localhost on my system i can received mail but when i published and put on the server i am not getting any mail
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 7, 2009, 11:01 PM EDT
mohdazeemuddin ahmed125 reputationPosted Aug 7, 2009, 11:59 PM EDT
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 8, 2009, 12:16 AM EDT
mohdazeemuddin ahmed125 reputationPosted Aug 8, 2009, 12:35 AM EDT
Server Error in '/ckom' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Insufficient permissions for setting the configuration property 'port'.
Source Error:
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 8, 2009, 12:56 AM EDT
protected void btnSendMail_Click(object sender, EventArgs e) { SmtpClient sc = new SmtpClient("smtp.gmail.com", 587); sc.EnableSsl = true; sc.Credentials = new NetworkCredential("[email protected]", "mypassword"); // Be Sure Where you Send mail to Check if Mail is Sent or Not MailMessage mail = new MailMessage(new MailAddress("[email protected]"), new MailAddress("[email protected]")); mail.Subject = "Testing "; mail.Body = "Hello This IS Testing "; sc.Send(mail); Response.Write("Mail Sent Successfully !!"); }