Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

System.net.Mail authenticate error on secured site

Posted on 2009-02-23
7
Medium Priority
?
275 Views
Last Modified: 2012-05-06
I have been using system.net.mail successfully on our main domain on our own web server.  We have a new domain and it has an SSL cert installed.  I am trying to use my same code and I get an error.  I am not sure what is wrong.  I have tried enableSSL as true and false and neither works.  If I set it to true I get an error "server does not support secure connections"  otherwise my error says:  "The server response was:  receipt's email relaying prohibited.  You should authenticate first."
Dim strFrom As String = "info@medispa-ins.com"
        Dim strTo As String = "virginia@tattoo-ins.com"
 
        Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
        MailMsg.BodyEncoding = Encoding.Default
        MailMsg.Subject = "Application"
        MailMsg.Body = "A new policy has been purchased.  Please see attached."
        MailMsg.Attachments.Add(New System.Net.Mail.Attachment(vFile))
        MailMsg.Priority = MailPriority.High
        MailMsg.IsBodyHtml = False
        Dim SmtpMail As New SmtpClient
        SmtpMail.Credentials = New System.Net.NetworkCredential("info@medispa-ins.com", "password")
        SmtpMail.Send(MailMsg)
        SmtpMail = Nothing
        MailMsg.Dispose()

Open in new window

0
Comment
Question by:vzorn
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:aibusinesssolutions
ID: 23717480
Are you using Secure SMTP?  If so you have to set the port of the SmtpMail object.

SmtpMail.Port = 465

Or whatever port you are using.
0
 

Author Comment

by:vzorn
ID: 23730879
I believe we are not using secure SMTP.  Our email server is a different box than our web server.   Only this one domain has an SSL cert installed on it.  I tried adding port 25 but it did not work, same error.  I tried to use the SSL port in IIS but I received an error :
Unable to read data from the transport connection: net_io_connectionclosed.

I am clueless!
0
 
LVL 15

Expert Comment

by:aibusinesssolutions
ID: 23733720
Ok, if you are not using secure SSL, then you don't want to use enableSSL.  It sounds like the problem is with your SMTP authentication.   Try this:

Dim SmtpMail As New SmtpClient
SmtpMail.UseDefaultCredentials = False  'Add this line
SmtpMail.Credentials = New System.Net.NetworkCredential("info@medispa-ins.com", "password")

Also, ensure that the email address that you are using is setup on the mail server you are trying to send through, and that the mail server allows relaying.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:vzorn
ID: 23741193
Well, I added SmtpMail.UseDefaultCredentials = False  but I still get an error.
I will check with our IT guy the mail server allows relaying.

I did figure out if I change the "To" address to an email address within our company it sends the email.  If the "To" is outside of our company it errors.  What does that mean?
0
 
LVL 15

Accepted Solution

by:
aibusinesssolutions earned 2000 total points
ID: 23741247
It means it's not allowing it to relay.  You are using SMTP authentication so it should work... is the From address a valid local email address?
0
 

Author Comment

by:vzorn
ID: 23741382
I changed the From address to another email and now it is working!
Thank you so much!
0
 

Author Closing Comment

by:vzorn
ID: 31550391
Thanks again for your help!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 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