Solved

SMTP via .NET program failure

Posted on 2015-02-19
1
60 Views
Last Modified: 2016-02-04
I have a program that handles vacation/sick requests which was recently moved from Server 2003 (IIS 6) to a new Server 2008 (IIS 7.5)

The notification email for when a user requests absence is no longer functioning.
 - It does however work for domain administrators!

I can ping and Telnet to the SMTP server which led me to believe it was a permission issue.
-I tried creating a new mailbox (Requests@domain) with everyone having full access permission
-I created a new receive connector allowing anonymous connection from the server IP




The program (SMTP Piece):

Dim email As New System.Net.Mail.MailMessage()
Dim client As New SmtpClient
client.UseDefaultCredentials = False
client.Credentials = New System.Net.NetworkCredential("username", "password")
client.DeliveryMethod = SmtpDeliveryMethod.Network
client.Host = AppSettings("SmtpServer")
email.From = New MailAddress("username@domain.com")
email.From = New MailAddress(AppSettings("EmailFrom"))
----------------------------------------------------------------------------------------------------------------------



This is the output if the user is not a domain admin:

[SocketException (0x277b): A system call has failed ***.***.***.***:25]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +273
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +584

[WebException: Unable to connect to the remote server]
   System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6) +8593522
   System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback) +8593954
   System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +3016971
   System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +286
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1500

[SmtpException: Failure sending mail.]
   System.Net.Mail.SmtpClient.Send(MailMessage message) +2392407
   GlobalFunctions.error_email(String txtst, String txtmsg, String user) in C:\inetpub\wwwroot\Intranet\Requests\App_Code\GlobalFunctions.vb:114
   _Default.btnSubmit_Click(Object sender, EventArgs e) in C:\inetpub\wwwroot\Intranet\Requests\Users\Users.aspx.vb:401
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
0
Comment
Question by:RISLA
1 Comment
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 500 total points
ID: 40621093
Is the application pool for your web application running under the same credentials as was on the old server? From the error, it sounds more like the web application itself does not have permissions to access resources on your mail server.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

785 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