Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-16
5
Medium Priority
?
428 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

971 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