Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i am making resume upload page in which i want to send resume on gmail account(another person gmail account) in asp.net c#
Posted
Comments
Ankur\m/ 4-Mar-14 1:05am    
Okay. So what is the question?

1 solution

try this:
first, include this namespace:
C#
using System.Net.Mail;


then create an Email function:

C#
void Email(string receiversname) //email to client
        {
            MailMessage MyMailMessage = new MailMessage();
            MyMailMessage.From = new MailAddress("youremail@gmail.com", "your title");
            MyMailMessage.To.Add(eadd);
            MyMailMessage.Subject = "your e-mail subject";
            MyMailMessage.IsBodyHtml = true;

            MyMailMessage.Body = "<body bgcolor=\"#F5F5F5\"><center><font face="\"Cambria\"">
            <pre lang="text">Note you can add more MyMailMessage.body here for the content of the email

C#
SmtpClient SMTPServer = new SmtpClient("smtp.gmail.com");
    SMTPServer.Port = 587;
    SMTPServer.Credentials = new System.Net.NetworkCredential("your email here", "your email's password");
    SMTPServer.EnableSsl = true;
    try
    {
        SMTPServer.Send(MyMailMessage);

    }
    catch (Exception ex)
    {


        ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + ex.Message + "');", true);


    }



now on your send button click event,

enter the following code:
C#
receiversname= txtEmail.Text.ToString();

C#
Email(receiversname);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900