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 713835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:00:23+00:00 2026-05-14T05:00:23+00:00

I have my code here, it works fine from my home, where my user

  • 0

I have my code here, it works fine from my home, where my user is administrator, and I am connected to internet via a cable network.
But, problem is when I try this code from my work place, it does not work. Shows error:
“unable to connect to the remote server”
From a different machine in the same network:
“A socket operation was attempted to an unreachable network 209.xxx.xx.52:25”

I checked with our network admin, and he assured me that all the mail ports are open [25,110, and other ports for gmail].

Then, I logged in with administrative privilege, there was a little improvement, it did not show any error, but the actual email was never received.

Please note that, the code was tested from development environment, visual studio 2005 and 2008.

Any suggestion will be much appreciated.
Thanks in advance

 try
    {
        MailMessage mail_message = new MailMessage("xxxxx@y7mail.com", txtToEmail.Text, txtSubject.Text, txtBody.Text);
        SmtpClient mail_client = new SmtpClient("SMTP.y7mail.com");
        NetworkCredential Authentic = new NetworkCredential("xxxxx@y7mail.com", "xxxxx");
        mail_client.UseDefaultCredentials = true;
        mail_client.Credentials = Authentic;
        mail_message.IsBodyHtml = true;
        mail_message.Priority = MailPriority.High;
        try
        {
            mail_client.Send(mail_message);
            lblStatus.Text = "Mail Sent Successfully";
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.Message);
            lblStatus.Text = "Mail Sending Failed\r\n" + ex.Message;
        }
    }
    catch (Exception ex)
    {
        lblStatus.Text = "Mail Sending Failed\r\n" + ex.Message;
    }
  • 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-05-14T05:00:23+00:00Added an answer on May 14, 2026 at 5:00 am

    Here is some sample code that works for me and talks to a gmail server

    private void SendEmail(string from, string to, string subject, string body)
        {
          MailMessage mail = new MailMessage(new MailAddress(from), new MailAddress(to));
    
          mail.Subject = subject;
          mail.Body = body; 
    
          SmtpClient smtpMail = new SmtpClient("smtp.gmail.com");
          smtpMail.Port = 587;
          smtpMail.EnableSsl = true;
          smtpMail.Credentials = new NetworkCredential("xxx@gmail.com", "xxx");
          // and then send the mail
          smtpMail.Send(mail);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code here which works perfectly in firefox but not in chrome
I have a little bit of Javascript that almost works correctly. Here's the code:
I have this code here, {foreach from=$cart.cartItems item=item name=cart} <div id=cart2Produkt> <p>{if $item.Product.ID} <a
I have this code right here to retrive the IP-address from a hostname: program
I have an image upload form and it works fine. But underneath that same
I have a piece of code here that does not work despite me using
I have the following code. Here I am matching the vowels characters words :
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
I have this code here, which is intended to allow any type of arguments:
Hey I have this code right here: http://pastie.org/534470 And on line 109 I get

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.