Click here to Skip to main content
15,884,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi below i have given my code when i run this code i get error "Transaction failed. The server response was: Mail from itsupport@xxxxx.in rejected for policy reasons."

VB
Const ToAddress As String = "Diler_Patel@Yahoo.com"
        Dim mm As New MailMessage("itsupport@xxxxx.in", ToAddress)
               mm.Subject = "DemoSubject" 'subject.Text
        mm.Body = "DemoBody" 'body.Text
        mm.IsBodyHtml = False

        '(3) Create the SmtpClient object
        Dim smtp As New SmtpClient
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network
        smtp.UseDefaultCredentials = False
        Dim basicAuthenticationInfo As New System.Net.NetworkCredential("itsupport@xxxxx.in", "password@123")
                smtp.Credentials = basicAuthenticationInfo
        smtp.Host = "xxxxx.in"

        smtp.Port = 25
        'smtp.EnableSsl = True
                smtp.Send(mm)


can u help me whats wrong with this code and one more thing if i enableSsl = true than i get error "Server dose not support Secure Connection"
Posted

Transaction failed. The server response was: Mail from itsupport@xxxxx.in rejected for policy reasons.
It clearly means that your email server did not allow email to be sent from the given email ID because of the policies defined by your mail server for sending an email. It can be because of any reason against defined policy like sending an exe file in email or some text in the email which is not appropriate. It might also happen that the user credentials are not authorized to do so.

Server dose not support Secure Connection
There are defined SMTP ports that allow secure connection. Looks like the port used to send email for SSL is not configured for the used port.

Make sure you have configured SMTP configuration correctly in Web.Config:
<system.net>
   <mailSettings>
     <smtp from="abc@somedomain.com">
       <network host="somesmtpserver" port="25" userName="name" password="pass" defaultCredentials="true" />
     </smtp>
   </mailSettings>
</system.net>

If needed, have a look at this Microsoft Video tutorial: Use ASP.NET to send Email from Website[^]
 
Share this answer
 
Your server does not support SSL on the default port; Most won't

This is apparently an issue with how the SMTP server is configured. You will need to get appropriate credentials, or have the SMTP server set to allow mail to be sent from the web server.
 
Share this answer
 
Try with Different Port. Due to security reasons, most of Admins have enabled other ports.
Contact your Network Administrator for SMTP Port number and proper configurations.
 
Share this answer
 
first many thanks to Mr Sandeep Mewara sir ur explaination helped me to reach exat problem


my Actuall problem was in mailing server Admin have blocked all the mailing ports and the have LOTUS NOTES server which send mail through port 25, but only LOTUS Notes server can send mail through that port i dont know how they did that. . . i wrote a code to send mail from lotus notes client which is installed on my web app server and i my code works fine and it triggers mail and is recived :)


thanks to everyone & CodeProject Team
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900