Solved

SMTP authentication is required' When IIS configured to send via localhost

Posted on 2011-09-16
5
422 Views
Last Modified: 2012-06-27
Hi All,

I am using the attached mailing script and configured IIS for this domain to use localhost to send email but still get the error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: SMTP authentication is required.

Now I don't know if this error is caused by my code or whether its an IIS settign that I have overklooked.

Could you provide any suggestions?

Thanks,

Rit

WEB.CONFIG
<system.net>
        <mailSettings>
            <smtp deliveryMethod="Network">
                <network host="127.0.0.1" port="25" defaultCredentials="false" />
            </smtp>


EMAIL FUNCTION


public static void SendHTMLMessage(string strEmailTemplate, string strSubject, string strFromAddress, string strFromAlias, string strToAddress)
    {
        SmtpClient mySmtpClient = new SmtpClient();
        MailAddress from = new MailAddress(strFromAddress, strFromAlias);
        MailAddress to = new MailAddress(strToAddress);
        MailMessage message = new MailMessage(from, to);
        message.BodyEncoding = Encoding.ASCII;
        message.IsBodyHtml = true;
        message.Subject = strSubject;
        message.Body = strEmailTemplate;
        mySmtpClient.Send(message);
    }

        </mailSettings>
    </system.net>

Open in new window

0
Comment
Question by:rito1
  • 2
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
gaurav05 earned 250 total points
ID: 36547953
Hi,

<system.net>
   <mailSettings>
      <smtp from="someaddress@myCTdomain.com">
         <network host="mail.myCTdomain.com" password="xxxxxx" port="25" userName="someaddress@myCTdomain.com"/>
      </smtp>
   </mailSettings>
</system.net>
0
 
LVL 1

Author Comment

by:rito1
ID: 36547973
Hi

From what I understand talking with our hosts, the server has been configured as an SMTP server and it doesn't need to be authenticated as emails can only be sent  from the server.

Rit
0
 
LVL 10

Expert Comment

by:gaurav05
ID: 36547998
hi,

you need to put smtp servers ip address in relay list and in connection control of SMTP server.

0
 
LVL 16

Assisted Solution

by:Easwaran Paramasivam
Easwaran Paramasivam earned 250 total points
ID: 36548045

Refer: http://www.systemwebmail.com/faq/3.8.aspx

SmtpMail.SmptServer = "ipaddress"
SmtpMail.Send(mailmsg);



0
 
LVL 1

Author Closing Comment

by:rito1
ID: 36548830
Hi All,

It turns out that the SMTP server uses port 26 instad of 25!

Thanks for you help anyway.

Rit
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Object Oriented Programming, C#, referencing, scoping. 13 69
abstract class C# 1 31
linq, c# 8 22
itextsharp with c# 3 5
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

840 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