?
Solved

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

Posted on 2011-09-16
5
Medium Priority
?
427 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
[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
  • 2
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
gaurav05 earned 1000 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

718 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