Requesting for the steps which i have to follow for developing contact form [Resolved]

Posted by Kondapallisrinivas under ASP.NET on 8/31/2012 | Points: 10 | Views : 2446 | Status : [Member] | Replies : 24
Hi All

I am planning to design some conatct page which contains mandatory fields

Name:.........
Email id:..........
Subject:..........
query:..........

After completing all the mandatory fields...If the user click on submit button then the total information which was submitted by the user has been reach to the concern person via email....So please suggest how i have to proceed

Please provide what code i have to add in the submit buton.And please provide step by step process how i can achive this

Thank you in advance

Regards
Kondapalli Srinivas




Responses

Posted by: Vuyiswamb on: 9/5/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 50

Up
0
Down

Resolved
Even if you run this locally but if you use your corporate Internet that uses the proxy to connect to the internet you will still be blocked. The code i wrote in that article always works as long as there is nothing blocking it.try to code in an External environment and check how it behaves

Thank you for posting at Dotnetfunda
[Administrator]

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Srilu.Nayini577 on: 8/31/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

write this code in button click:

var fromAddress = "Gmail@gmail.com";{u can take from address from web.config file also}

var toAddress = txtmailid.Text.ToString();

string subject = txtSubject.Text.ToString();
string body = "From: " + txtName.Text + "\n";
body += "Email Id: " + txtmailid.Text + "\n";
body += "Subject: " + txtSubject.Text + "\n";
body += "Query: \n" + txtQuery.Text + "\n";

var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress); smtp.Timeout = 20000;
}

smtp.Send(fromAddress, toAddress, subject, body);


Try this way.
Thank you,

SRILATHA
.Net Developer

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Srilu.Nayini577 on: 8/31/2012 [Member] Starter | Points: 25

Up
0
Down
You can refer this urls:
http://www.c-sharpcorner.com/UploadFile/dchoksi/SendingMail02132007002923AM/SendingMail.aspx

http://bradkingsley.com/sending-email-from-asp-net-4-c-sample-code/

SRILATHA
.Net Developer

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 8/31/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Srilatha

Thank you for your reply

"i am getting the error message as System.Net.Mail.SmtpException: The operation has timed out ".when i try with the code which you provide as a first reply...

and even i try with the code which from the urls also....It is not that much of help full

Please provide the resolution steps for the issue


Regards
Kondapalli Srinivas

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nksingh420 on: 8/31/2012 [Member] Starter | Points: 25

Up
0
Down
Web.config File
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.net>
<mailSettings>
<smtp>
<network host="mail.google.com" port="25" userName="abc@gmail.com" password="########" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Code Page

System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient();
MailMessage Message = new MailMessage("uremailid.Text", "toemailid.Text", "Subject", "query");
Client.Send(Message);



Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/1/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Singh

Thank you for your reply

I tried with the code which you given.....but no useful...still i am unable to send the mail....so please post if you have any more solutions


Regards
Kondapalli Srinivas

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/1/2012 [Member] Starter | Points: 25

Up
0
Down
Please any one help for me by providing step by step process for devloping the contact form

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nksingh420 on: 9/1/2012 [Member] Starter | Points: 25

Up
0
Down

btn_click()
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage("youremail@gmail.com",receiveremail@gmail.com,"Subject",Body);
msg.IsBodyHtml = false;
System.Net.NetworkCredential mailaut = new System.Net.NetworkCredential("youremail@gmail.com", "uremailpassword");
System.Net.Mail.SmtpClient mailclient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
mailclient.EnableSsl = true;
mailclient.UseDefaultCredentials = false;
mailclient.Credentials = mailaut;
mailclient.Send(msg);
}


This code will work if not then pls give me ur mail id i will send you .... or email me neerajkrsingh88@gmail.com

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nksingh420 on: 9/1/2012 [Member] Starter | Points: 25

Up
0
Down

btn_click()
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage("youremail@gmail.com",receiveremail@gmail.com,"Subject",Body);
msg.IsBodyHtml = false;
System.Net.NetworkCredential mailaut = new System.Net.NetworkCredential("youremail@gmail.com", "uremailpassword");
System.Net.Mail.SmtpClient mailclient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
mailclient.EnableSsl = true;
mailclient.UseDefaultCredentials = false;
mailclient.Credentials = mailaut;
mailclient.Send(msg);
}


This code will work if not then pls give me ur mail id i will send you .... or email me neerajkrsingh88@gmail.com

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
Please any one help for me by providing step by step process for devloping the contact form


Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
Hey Srinivas,

Whats your requirement, could you please elaborate??

G. S.
.Net Developer

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
Dear Gopesh

I am trying to develope one contact form which contains

Name:......
EmailID:.......
Subject:...........
Query:.........


After filling all the mandatory filelds by the user...By clicking the submit button...The information which was filled by the user has been reached to the concer person via email(which was fixed by default)....

Regards
Kondapalli Srinivas



Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
You can use the code like this...

protected void SendMail()

{
var fromEmailID = "Your Email ID";
var toEmailID = "Where you are sending";
const password = "Your Password";
string subjectOfEmail = "Subject of Email";
string bodyOfEmail = "Name" + "EmailID" + "Subject" + "Query";
var smtpClient = new System.Net.Mail.SmtpClient();
{
smtp.Host = "Name of the Host";
smtp.Port = "port Number";
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 5000;
}
smtp.Send(fromEmailID, toEmailID, subjectOfEmail, bodyOfEmail );
}

protected void Button1_Click(object sender, EventArgs e)
{
try
{
SendMail();
}
catch (Exception) { }
}


G. S.
.Net Developer

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Gopesh


Thank you for your reply.....

I tryied with that code earlier....but i didnt get the solution....even i tried it now also....but still i am not getting any mail.....

Please send the code if you tried.....to my email(saisrinivasa15@gmail.com)....

Or else share your id....so that i send my code to your id....please correct if i did any thing wrong

Thank you vary much
Have a nice day

Regards
Kondapalli srinivas

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/3/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Look at this

http://www.dotnetfunda.com/articles/article747-how-to-send-an-e-mail-using-gmail-in-aspnet.aspx

Thank you for posting at Dotnetfunda
[Administrator]

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Vuyiswamb

When i tried with process which is in article i am getting the error message A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 173.194.69.109:587


Can you please say where i have to do modifications to resolve this error

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Vuyiswamb

When i tried with process which is in article i am getting the error message A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 173.194.69.109:587


Can you please say where i have to do modifications to resolve this error


Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/4/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Are you using a Proxy to connect to the Internet ?

Thank you for posting at Dotnetfunda
[Administrator]

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
Yes...Our corporate n\w has proxy....

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
Yes...Our corporate n\w has proxy....


Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/4/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
That is exactly whats block you. If you host this in some cheap paid domain it will work , there are no restrictions

Thank you for posting at Dotnetfunda
[Administrator]

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
So in this case how we can over come this issue????

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
Dear Vuyiswamb

And we want to clear one thing for you we are running the application at localmachine only.....And we did not host the appliaction yet......

Is the code works in this case?????

Regards
Kondapalli Srinivas

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kondapallisrinivas on: 9/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hello All

Please help for our team to resolve this issue.....we tried in many ways....but we didnt get fruit for any of our trails....So please help for us.....To resolve the issue....

Regards
Kondapalli Srinivas

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response