Solved

Send mail in C3 winform

Posted on 2010-08-18
3
422 Views
Last Modified: 2013-12-18
I am trying to send an email from a computer outside the company network using the company email server that has internet access though mail.mycompany.com - I keep getting host did not connect
here is the error
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 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 192.0.0.0



private void btnEmail_Click(object sender, EventArgs e)
        {
            if (txtbxEmail.Text.Trim() == string.Empty || txtbxName.Text.Trim() == string.Empty)
            {
                MessageBox.Show("You must enter a name and email address");
                return;
            }
            //create the mail message
            MailMessage mail = new MailMessage();

            //set the addresses
            mail.From = new MailAddress(txtbxEmail.Text);
            mail.To.Add("me@mycompany.com");
            //mail.ReplyTo(txtbxEmail.Text);

            //set the content
            mail.Subject = lblNotifier.Text;
            mail.Body = txtbxNumber.Text + " " + txtbxName.Text;
            

            //send the message
            //SmtpClient smtp = new SmtpClient            SmtpClient smtp = new SmtpClient("mail.mycompany.com");
            //smtp.Credentials = new System.Net.NetworkCredential(@"domain\me", "pass");
            smtp.
            //MessageBox.Show(smtp.ToString());
            smtp.Send(mail);
            btnEmail.Enabled = false;
            
            MessageBox.Show("Email Sent");
            this.Close();
            this.Dispose();

            

        }

Open in new window

0
Comment
Question by:r3nder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Expert Comment

by:mediakultur
ID: 33468267
Can you telnet on port 80 to the remote server?  From a different machine to the remote system, type telnet x.x.x.x 80 (replace x.x.x.x) with the actual ip address.  could be a windows firewall issue.
0
 
LVL 6

Author Comment

by:r3nder
ID: 33468426
Sorry that one didnt work any Ideas would be helpful
Thanks
0
 
LVL 6

Accepted Solution

by:
r3nder earned 0 total points
ID: 33468623
found it! - my ISP is blocking port 25
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question