Solved

Send mail in C3 winform

Posted on 2010-08-18
3
406 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
  • 2
3 Comments
 

Expert Comment

by:mediakultur
Comment Utility
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
Comment Utility
Sorry that one didnt work any Ideas would be helpful
Thanks
0
 
LVL 6

Accepted Solution

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

New-MailboxSearch Powershell Command and step by step approach to Search and Extract Emails form Exchange 2013 Journaling server.
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In this video we show how to create a mailbox database 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 Servers >> Data…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now