Click here to Skip to main content
15,906,947 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to pass and use web page to an external class? Pin
QuickBooksDev31-Dec-14 0:23
QuickBooksDev31-Dec-14 0:23 
GeneralRe: How to pass and use web page to an external class? Pin
Dominic Burford31-Dec-14 0:40
professionalDominic Burford31-Dec-14 0:40 
GeneralRe: How to pass and use web page to an external class? Pin
QuickBooksDev31-Dec-14 1:36
QuickBooksDev31-Dec-14 1:36 
GeneralRe: How to pass and use web page to an external class? Pin
Dominic Burford31-Dec-14 1:56
professionalDominic Burford31-Dec-14 1:56 
GeneralRe: How to pass and use web page to an external class? Pin
QuickBooksDev4-Jan-15 5:35
QuickBooksDev4-Jan-15 5:35 
AnswerRe: How to pass and use web page to an external class? Pin
Ferd Really20-Jan-15 6:31
Ferd Really20-Jan-15 6:31 
GeneralRe: How to pass and use web page to an external class? Pin
QuickBooksDev20-Jan-15 7:11
QuickBooksDev20-Jan-15 7:11 
QuestionStill i cant send email .will someone help? does any change require for smtp? Pin
Member 1133603427-Dec-14 5:39
Member 1133603427-Dec-14 5:39 
Still i cant send email .will someone help? does any change require for smtp?
when i click the button it does nt send the mail..
will someone help me to get mail..

i have changed the sender email and password here.


my code on button click


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Net;
using System.Net.Mail;


namespace sms2
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }


        protected void SendMail()
        {
            // Gmail Address from where you send the mail
            var fromAddress = "net@gmail.com";
            // any address where the email will be sending
            var toAddress = YourEmail.Text.ToString();
            //Password of your gmail address
            const string fromPassword = "12345";
            // Passing the values and make a email formate to display
            string subject = YourSubject.Text.ToString();
            string body = "From: " + YourName.Text + "\n";
            body += "Email: " + YourEmail.Text + "\n";
            body += "Subject: " + YourSubject.Text + "\n";
            body += "Question: \n" + Comments.Text + "\n";
            // smtp settings
            var smtp = new System.Net.Mail.SmtpClient();
            {
                smtp.Host = "smtp.gmail.com";
               // smtp.Port = 587;
                smtp.Port = 2525;
                smtp.EnableSsl = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
               // request.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                smtp.Credentials = new System.Net.NetworkCredential(fromAddress, fromPassword);
                //smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
                smtp.Timeout = 20000;
            }
            // Passing values to smtp object
            smtp.Send(fromAddress, toAddress, subject, body);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                //here on button click what will done
                SendMail();
                DisplayMessage.Text = "Your Comments after sending the mail";
                DisplayMessage.Visible = true;
                YourSubject.Text = "";
                YourEmail.Text = "";
                YourName.Text = "";
                Comments.Text = "";
            }
            catch (Exception) { }
        }



    }

}

SuggestionRe: Still i cant send email .will someone help? does any change require for smtp? Pin
Richard MacCutchan27-Dec-14 9:34
mveRichard MacCutchan27-Dec-14 9:34 
GeneralRe: Still i cant send email .will someone help? does any change require for smtp? Pin
Member 1133603427-Dec-14 18:06
Member 1133603427-Dec-14 18:06 
GeneralRe: Still i cant send email .will someone help? does any change require for smtp? Pin
Richard MacCutchan27-Dec-14 23:10
mveRichard MacCutchan27-Dec-14 23:10 
Questioni am facing the NetworkCredential problem which is given below Pin
Member 1133603426-Dec-14 1:12
Member 1133603426-Dec-14 1:12 
AnswerRe: i am facing the NetworkCredential problem which is given below Pin
Wendelius26-Dec-14 1:56
mentorWendelius26-Dec-14 1:56 
GeneralRe: i am facing the NetworkCredential problem which is given below Pin
Member 1133603427-Dec-14 5:32
Member 1133603427-Dec-14 5:32 
AnswerRe: i am facing the NetworkCredential problem which is given below Pin
ZurdoDev26-Dec-14 2:05
professionalZurdoDev26-Dec-14 2:05 
GeneralRe: i am facing the NetworkCredential problem which is given below Pin
Member 1133603427-Dec-14 5:32
Member 1133603427-Dec-14 5:32 
QuestionHow to check login OWA success or not (Exchange 20007) Pin
rosy8425-Dec-14 4:30
rosy8425-Dec-14 4:30 
AnswerRe: How to check login OWA success or not (Exchange 20007) Pin
syed shanu25-Dec-14 17:33
professionalsyed shanu25-Dec-14 17:33 
QuestionHow can to change the properties of a control in another page? Pin
Member 1130721224-Dec-14 13:06
Member 1130721224-Dec-14 13:06 
AnswerRe: How can to change the properties of a control in another page? Pin
ZurdoDev26-Dec-14 2:03
professionalZurdoDev26-Dec-14 2:03 
QuestionHow can to change the properties of a control in another page? Pin
Member 1130721224-Dec-14 12:04
Member 1130721224-Dec-14 12:04 
AnswerRe: How can to change the properties of a control in another page? Pin
ZurdoDev26-Dec-14 2:04
professionalZurdoDev26-Dec-14 2:04 
AnswerRe: How can to change the properties of a control in another page? Pin
sudevsu29-Dec-14 2:33
sudevsu29-Dec-14 2:33 
QuestionProgress bar or Status in ASPX page Pin
sudevsu23-Dec-14 6:50
sudevsu23-Dec-14 6:50 
AnswerRe: Progress bar or Status in ASPX page Pin
jkirkerx23-Dec-14 8:57
professionaljkirkerx23-Dec-14 8:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.