Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:46:06+00:00 2026-06-05T11:46:06+00:00

SmtpClient smtpClient = new SmtpClient(smtp.gmail.com); smtpClient.Credentials = new NetworkCredential(xxxxx@gmail.com, password); smtpClient.Port = 587; smtpClient.EnableSsl

  • 0
                SmtpClient smtpClient = new SmtpClient("smtp.gmail.com");
                smtpClient.Credentials = new NetworkCredential("xxxxx@gmail.com", "password");
                smtpClient.Port = 587;
                smtpClient.EnableSsl = true;

                MailMessage mail = new MailMessage();
                //mail.From = new MailAddress("xxx1@gmail.com");
                mail.To.Add("XX2@gmail.com");
                mail.Subject = "Test mail";
                mail.Body = "This is test mail, with test content";
                smtpClient.Send(mail);

In the above code, why mail.From is mandatory? even I specified mail-id in smtpClient.Credentials.

Even I specified mail.From with some mail-id, the receiver is not receiving mail from this mail address, instead receiving from xxxxx@gmail.com which I specified in smtpClient.Credentials.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:46:08+00:00Added an answer on June 5, 2026 at 11:46 am

    From is supposed to be the address from where the mail was sent.
    This can be different from your Smtp credentials. Some servers will let you have a username that is different from your mail address.

    Gmail shows the email address from where it received the mail.
    They do that so that users don’t mistake getting the mail from someone who didn’t really send it.
    Not all email clients do that.

    You cannot fake a from address to gmail. They will always show where they got the email from.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code for sending email through Gmail's smtp: SmtpClient client = new SmtpClient(smtp.gmail.com, 587);
string from = abc@gmail.com; string to = xyz@gmail.com,xyz@yahoo.co.in; string password=abcxyz; MailMessage mail = new
Why does this timeout? Dim s As New SmtpClient s.Host = smtp.gmail.com s.Port =
I'm using the following basic code: System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage(); msg.to.add(someone@hotmail.com); msg.to.add(someone@gmail.com); msg.to.add(someone@myDomain.com);
This is my Web.config: <system.net> <mailSettings> <smtp deliveryMethod=Network> <network defaultCredentials=true enableSsl=true host=smtp.gmail.com port=25 userName=xxxxxxx@gmail.com
I have code for sending email to clients. System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient(); MailMessage
the VMware is able to ping the gmail server. sample code MailMessage mail =
I need to send mail using Gmail SMTP, but it's showing Failure sending mail.
Below is my coding, just have a look at it System.Net.Mail.MailMessage oMail = new
I am using SmtpClient to sent out email. I create some function in Mail

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.