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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:56:18+00:00 2026-06-09T16:56:18+00:00

This my code that i wrote it MailMessage msg = new MailMessage(); msg.From =

  • 0

This my code that i wrote it

        MailMessage msg = new MailMessage();

        msg.From = new MailAddress("noreply@xxx.com", "My site                Registratration");
        msg.To.Add(new MailAddress(email, name, System.Text.Encoding.UTF8));
        msg.Subject = "xxx- Register Account";
        msg.IsBodyHtml = true;
        msg.DeliveryNotificationOptions = DeliveryNotificationOptions.None;
        msg.Priority = MailPriority.Normal;

        StreamReader sr = new StreamReader(Server.MapPath("~/ActiveMail.htm"));
        string temp = sr.ReadToEnd();
        temp = temp.Replace("[###Name###]", name).Replace("[###Url###]", key);
        msg.Body = temp;

        SmtpClient smtp = new SmtpClient("mail.xxx.com");
        System.Net.NetworkCredential perm = new    System.Net.NetworkCredential("noreply@xxx.com", "My host email's password");
        smtp.Credentials = perm;
        smtp.Send(msg);

it seems that it must work
but at the smtp.Send(msg) part i receive the error that email failed to send.
Is there any one to help me?
Thanks alot

Stack Trace:

[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 110.4.46.160:25]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +225
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +279

[WebException: Unable to connect to the remote server]
   System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +6054548
   System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +314
   System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
   System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +322
   System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +146
   System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) +170
   System.Net.Mail.SmtpClient.GetConnection() +50
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1484

[SmtpException: Failure sending mail.]
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1811
   NewUser.SendEmail(String email, String name, String key) in g:\Programming\Projects\xxx\xxxWebsite(Mysql)\NewUser.aspx.cs:99
   NewUser.SignupBtn_Click(Object sender, EventArgs e) in g:\Programming\Projects\xxx\xxxWebsite(Mysql)\NewUser.aspx.cs:69
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10



 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
  • 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-09T16:56:19+00:00Added an answer on June 9, 2026 at 4:56 pm

    The following works well for me, try setting your host and port:

            var email = new MailMessage();
            email.From = new MailAddress("johnnytables@xkcd.com");
            email.To.Add("johnnysmom@xkcd.com");
            email.Subject = "DROP TABLE STUDENT";
            email.Body = "Our student records are gone!";
    
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "127.0.0.1";
            smtp.Port = 25;
            smtp.UseDefaultCredentials = true;
            smtp.Credentials = new NetworkCredential("johnnytables@xkcd.com", "password");
            smtp.Send(email);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this code, it gets an image from a link that varies according
I wrote this code that compiles on Solaris gcc it works fine too for
I wrote this piece of code that is supposed to redirect something written on
I have a program I wrote in Windows with this piece of code that
I wrote this code that when you click on the element the element above
I have this code that someone else wrote and am wondering, what this jQuery
This is the code that I wrote: $result = $textProc->sentiment($text); $json_a = json_decode($result, true);
I wrote this code that fills an array and a second array copies the
this is my code that I write it but I want to use LINQ
I want to write a line of code that returns a pointer to this

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.