﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Cannot Send SMTP Email</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 02:18:46 GMT</lastBuildDate><ttl>20</ttl><item><title>Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23382.aspx</link><description>I am stumped...here is my code:&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
MailMessage mMail = new System.Net.Mail.MailMessage();&lt;br&gt;
mMail.Body = String.Format("Sales order ID {0} has been recently edited by {1}.  The new order total {2:c} has increased which exceeds the previously approved amount of {3:c}.", mSalesOrder.orderid, AspireGlobals.CurrentUser.FullName, mSalesOrder.OrderTotal, _salesordertotal);&lt;br&gt;
mMail.From = new MailAddress(AspireGlobals.CurrentUser.EmailAddress);&lt;br&gt;
mMail.Subject = "Sales Order Exceeds Approved Total!";&lt;br&gt;
mMail.To.Add(new MailAddress("bcunnien@spiratex.com"));&lt;br&gt;
SmtpClient mSmtpClient = new SmtpClient("192.168.2.247");&lt;br&gt;
mSmtpClient.UseDefaultCredentials = true;&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
    mSmtpClient.Send(mMail);&lt;br&gt;
}&lt;br&gt;
catch (Exception ex)&lt;br&gt;
{&lt;br&gt;
    MessageForm.ShowMessage("Aspire Information", String.Format("{0} :: {1} ({2})", ex.Message, ex.InnerException, ex.StackTrace), "Send Email", MicroFour.StrataFrame.Messaging.MessageFunction.OK, MicroFour.StrataFrame.Messaging.MessagingIcon.Information, MicroFour.StrataFrame.Messaging.MessagingSounds.Notify);&lt;br&gt;
}&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
I get no error.  No email is sent.  The IP address is our Exchange server.  Is there some credential's trick that I need to get SMTP traffic to flow through our Exchange server?  I have tried other servers that have SMTP running, but none of them are sending an email, either.  I can watch a connection being established in the Client Connections of the SMTP server via IIS...the connection persists until I actually close my application or it times out.&lt;br&gt;
&lt;br&gt;
Anyone have any ideas about this one?&lt;br&gt;
&lt;br&gt;
Thanks!!&lt;br&gt;
Bill</description><pubDate>Tue, 09 Jun 2009 08:56:37 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23429.aspx</link><description>On our Exchange server, one of the anti-spam policies was being run in the wrong order.  I moved the Custom Allow by IP Address up before the Anti-Spoofing policy and now I can send intra-domain emails via code.&lt;br&gt;
&lt;br&gt;
I am glad I finally got this solved.  :D&lt;br&gt;
&lt;br&gt;
Time for a vacation.  :w00t:</description><pubDate>Tue, 09 Jun 2009 08:56:37 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23426.aspx</link><description>That doesn't make any sense!  This could be coming from your mail server more than from the SMTP client.  I will have to test this and see if I get the same results...that is definitely strange!  Glad you got it going! :)</description><pubDate>Tue, 09 Jun 2009 06:37:42 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23414.aspx</link><description>Sorry...apparently highlighting does not work within a code snippet.  The key change was the following line:&lt;br&gt;
&lt;br&gt;
mMail.From = new MailAddress("aspire@spiratex.net");&lt;br&gt;</description><pubDate>Mon, 08 Jun 2009 11:21:02 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23413.aspx</link><description>Here's the thing guys (btw, thanks to everyone for the help...much appreciated!), the From address cannot be in the same domain.&lt;br&gt;
&lt;br&gt;
Yup, I agree it is quite odd.  Here is my adjusted code that actually works!&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
MailMessage mMail = new MailMessage();&lt;br&gt;
mMail.IsBodyHtml = true;&lt;br&gt;
mMail.Body = String.Format("Sales order ID {0} has been recently edited by {1}.  The new order total {2:c} has increased which exceeds the previously approved amount of {3:c}.", mSalesOrder.orderid, AspireGlobals.CurrentUser.FullName, mSalesOrder.OrderTotal, _salesordertotal);&lt;br&gt;
[highlight=#ffff11]mMail.From = new MailAddress("aspire@spiratex.net");[/highlight]&lt;br&gt;
mMail.Subject = "Sales Order Exceeds Approved Total!";&lt;br&gt;
mMail.To.Add("userA@spiratex.com");&lt;br&gt;
mMail.CC.Add("userB@spiratex.com");&lt;br&gt;
SmtpClient mSmtpClient = new SmtpClient("SPFS01");&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
    mSmtpClient.Send(mMail);&lt;br&gt;
}&lt;br&gt;
    catch (Exception ex)&lt;br&gt;
{&lt;br&gt;
    MessageForm.ShowMessage("Aspire Information", String.Format("{0} :: {1} ({2})", ex.Message, ex.InnerException, ex.StackTrace), "Send Email", MicroFour.StrataFrame.Messaging.MessageFunction.OK, MicroFour.StrataFrame.Messaging.MessagingIcon.Information, MicroFour.StrataFrame.Messaging.MessagingSounds.Notify);&lt;br&gt;
}&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
This is working so I can pragmatically move on.  Does anyone know the reason for this behavior?&lt;br&gt;
&lt;br&gt;
Thanks, again!&lt;br&gt;
Bill</description><pubDate>Mon, 08 Jun 2009 11:20:00 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23388.aspx</link><description>Bill, I PM'd you some code to test using my public SMTP server, I know the code works, if you cant send with that... it must be ISP, firewall, etc</description><pubDate>Fri, 05 Jun 2009 14:34:03 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23387.aspx</link><description>Be aware that many antivirus program will block port 25 for SMTP and also may ISP may monitor the traffic used by the smtp and may be blocking out your IP or your SMTP server.</description><pubDate>Fri, 05 Jun 2009 14:18:50 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23386.aspx</link><description>Thanks!  I did try the NetworkCredential's route as you guys outlined.  Still no email gets sent.  Still stumped.</description><pubDate>Fri, 05 Jun 2009 14:06:46 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23384.aspx</link><description>I know this works. MyEmail is just a structure that holds the email content and authentication info.&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; SendEmail(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; messageInfo &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; MyEmail)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; mail_Email &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; MailMessage()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; smtp &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; SmtpClient(messageInfo._smtpServer)&lt;/P&gt;&lt;P&gt;mail_Email.To.Add(messageInfo._ToAddress)&lt;/P&gt;&lt;P&gt;mail_Email.From = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; MailAddress(messageInfo._FromAddress, messageInfo._FromText)&lt;/P&gt;&lt;P&gt;mail_Email.Subject = messageInfo._Subject&lt;/P&gt;&lt;P&gt;mail_Email.IsBodyHtml = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;True&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;mail_Email.Body = Err.ToString&lt;/P&gt;&lt;P&gt;smtp.Credentials = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; Net.NetworkCredential(messageInfo._smtpUser, messageInfo._smtpPassword)&lt;/P&gt;&lt;P&gt;smtp.Send(mail_Email)&lt;/P&gt;&lt;P&gt;mail_Email.Dispose()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Fri, 05 Jun 2009 12:33:53 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Cannot Send SMTP Email</title><link>http://forum.strataframe.net/FindPost23383.aspx</link><description>Yeah, if you do not support relay (as you most likely do not) then you need to supply the credentials.  For example:&lt;br&gt;
&lt;br&gt;
[codesnippet]SmtpClient _SMTP = new SmtpClient("MyMailServer", 25);&lt;br&gt;
NetworkCredential _LoginCredentials = new NetworkCredential("UserName", "Password", "Domain");&lt;br&gt;
&lt;br&gt;
_SMTP.Credentials = _LoginCredentials;[/codesnippet]&lt;br&gt;
&lt;br&gt;
You may add this and see if you get anywhere.  I will say, however, that you will generally get an error if it cannot authenticate.  But this might at least prompt some ideas!</description><pubDate>Fri, 05 Jun 2009 12:31:29 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>