?
Solved

SMTP does not send, does not error-out, seems to do nothing!

Posted on 2010-11-11
5
Medium Priority
?
296 Views
Last Modified: 2012-06-21
I am running the following code.  I have a breakpoint set so I know the code is being run.  After the code runs, I get NO email in my inbox.  Nor does an exception get raised.  The code runs and nothing seems to happen, period.  

::: LOST :::::

Is there a way to find-out if the SMTP server is responding at all, or where the failure point is?  Normally if the SMTP server were down or something, I would expect an exception to get raised by the code, right?
protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string body = "";
        body = "Name: " + tbName.Text + "<br>";
        body += "Phone: " + tbPhone.Text + "<br>";
        body += "Email: " + tbEmail.Text + "<br>";
        body += "Subject: " + ddlSubject.SelectedValue.ToString() + "<br>";
        body += "Body: <br>" + tbBody.Text + "<br>";


        //try
        //{

        //    IWEB.eMail.SendMail("TCSMail@total-computing.com","TCSMail@total-computing.com", "TotaLink Information Request", body, tbName.Text, true);
        //    if (cbSendCopy.Checked)
        //        IWEB.eMail.SendMail("TCSMail@total-computing.com", tbEmail.Text, "TotaLink Information Request", body, "TCS Support", true);
        //    panelEmail.Visible = false;
        //    lblInfo.Text = "Thanks! We will get back to you soon.";
        //    hlReturnHome.Visible = true;
        //}
        //catch
        //{
        //    lblInfo.Text = "There was a problem, please try again later";
        //}


        string host = System.Configuration.ConfigurationManager.AppSettings["SMTP_SERVER"] as string;
        string erremailaddy = System.Configuration.ConfigurationManager.AppSettings["ERROREMAIL"] as string;
        string smtpusername = System.Configuration.ConfigurationManager.AppSettings["SMTP_USERNAME"] as string;
        string smtppassword = System.Configuration.ConfigurationManager.AppSettings["SMTP_PASSWORD"] as string;
        string storename = System.Configuration.ConfigurationManager.AppSettings["StoreName"] as string;
        string dbtype = System.Configuration.ConfigurationManager.AppSettings["DBTYPE"] as string;
      
        System.Net.Mail.SmtpClient smpt = new System.Net.Mail.SmtpClient();
        smpt.UseDefaultCredentials = false;
        smpt.Credentials = new System.Net.NetworkCredential(smtpusername, smtppassword);
        System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
        
        msg.Body = "<b><h1>" + body + "</h1></b><br><br>" + body;
        smpt.Host = host;
        msg.IsBodyHtml = true;
        msg.From = new System.Net.Mail.MailAddress("TCSMail@total-computing.com", "IWEB ERROR");
        msg.Subject = "IWEB ERROR AT " + storename;
        msg.To.Add(erremailaddy);

        smpt.Send(msg);


    }

Open in new window

0
Comment
Question by:Tom Knowlton
[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
  • 3
5 Comments
 
LVL 2

Accepted Solution

by:
tan_dev earned 1000 total points
ID: 34113562
SmtpClient didnt work for me as well. Try replacing your specifics in code below:

 MailMessage msg = new MailMessage();
                    msg.From = "Fusion@abcd.com";
                    msg.To = people.Email;
                    msg.Subject = "Fusion Task Reminder: " + DateTime.Now.ToString();
                    msg.Body = body;
                    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25");
                    SmtpMail.SmtpServer = "cetmanexch01";
                    SmtpMail.Send(msg);
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 34113729
I will try that.


In the meantime I tried the following from the command line on the webserver:
220 total-computing.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 rea
dy at  Thu, 11 Nov 2010 10:27:45 -0700
EHLO total-computing.com
250-total-computing.com Hello [166.70.89.203]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
MAIL FROM:TCSMail@total-computing.com
250 2.1.0 TCSMail@total-computing.com....Sender OK
RCPT TO:Tom.Knowlton@total-computing.com
500 5.3.3 Unrecognized command
RPCT TO:Tom.Knowlton@total-computing.com
500 5.3.3 Unrecognized command
RCPT TO: Tom.Knowlton@total-computing.com
501 5.5.4 Invalid Address
RCPT TO:Tom.Knowlton@total-computing.com
250 2.1.5 Tom.Knowlton@total-computing.com
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Subject: test message

This is a test
.
550 5.7.1 Requested action not taken: message refused


Connection to host lost.

C:\Windows\system32>

Open in new window

0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 34113750
What is MailMessage?

This is not recoginized.  What DLL do I reference?
0
 
LVL 1

Assisted Solution

by:NileshThakkar
NileshThakkar earned 1000 total points
ID: 34122750
Once i had gone across such situation..finally i found that there was one setting in ANTIVIRUS software installed on my PC which was denying to send my email through code. I just closed antivirus service and then run code.. and it worked for me..

I don't know this is the same case with you or not. But at least u can try this. Hope it gets work there..
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 34180992
thx
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

771 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