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

  • Home
  • SEARCH
  • 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 8547765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:20:16+00:00 2026-06-11T13:20:16+00:00

i am creating an Email sending sample application, and i want to use send

  • 0

i am creating an Email sending sample application, and i want to use send email from different email address like “gmail, yahoo, hotmail” so i don’t want to use “smtp.email.com” as host, because if i use “smtp.email.com” as host i will have to change my host name for every different company like(“smtp.gmail.com” for gmail or “smtp.mail.yahoo.com” for yahoo.com ) so
Can i use IP Address as SMTP host rather then smtp.email.com.

Please give me a solution for this so that without changing smtp host name i can use different email company to send email.

this is my code:

        try
        {
            // setup mail message
            MailMessage message = new MailMessage();
            message.From = new MailAddress(textBox1.Text);
            message.To.Add(new MailAddress(textBox2.Text));
            message.Subject = textBox3.Text;
            message.Body = richTextBox1.Text;

            // setup mail client
            SmtpClient mailClient = new SmtpClient("smtp.gmail.com");//here i have to change SMTP host for different email company 
            mailClient.Credentials = new NetworkCredential(textBox1.Text,"password");

            // send message
            mailClient.Send(message);

            MessageBox.Show("Sent");
        }
        catch(Exception)
        {
            MessageBox.Show("Error");
        }
  • 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-11T13:20:17+00:00Added an answer on June 11, 2026 at 1:20 pm

    Sure you could use IP addresses instead of names, but remember then if they ever changed the IP you’re goning to stop working.. BUT…. this needs to change depending on what you are sending the mail as unless you find some form of relay proxy thats open.. AS yahoo wont recveive gmail and gmail wont receive yahoo etc.. The reality is if you are sending as that it would end up changing wether you used an IP or a name.

    Your webserver however will most likely send mails from your domain, rather than your gmail/yahoo accounts.. why not send it from your domain? eg noreply@myweb.com then the smtp server remains the same as its your web provider

    Of course you could do

    SmtpClient mailClient
    if (textbox1.Text.Contains("gmail") 
    {
                mailClient = new SmtpClient("smtp.gmail.com");/
                mailClient.Credentials = new NetworkCredential(textBox1.Text,"password"); 
    }
    else if (textbox1.Text.Contains("somemail") 
    {
                mailClient = new SmtpClient("smtp.somemail.com");/
                mailClient.Credentials = new NetworkCredential(textBox1.Text,"password"); 
    }
    

    etc

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

Sidebar

Related Questions

I am creating simple email sending application. In my application when ever I send
i am creating attached file email sending application, in my application i want to
Let's say your creating an application that needs to send you an email monthly.
I am creating an email software which send email to some accounts. I want
I am creating a email queue to handle email sending. From that queue I'm
I'm creating a program for sending mail. I want to use Javascript for validation
i am creating an simple email sending application, in my application every time i
I'm considering using a fire-and-forget pattern for sending emails from an ASP/C# application, so
I am creating a file to send as an attachment to an email. Now
Is there any way to programatically forward email messages from Gmail to another email

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.