Answered by:
Cannot send mails to outside email addresses..

Question
-
User1357926729 posted
I need to send Email from my webpage when the manager approves a request.the send address and to address is taken from the database.My issue is that i can sent the mail only to the company emil adresses ie,the emil id's which ends in @log-ram.com.I cant send it to outside email id's like gmail and yahoo.relay denied error is coming.Can anyone tell me the olution.Is it the problem with my system SMTP server.How can i correct it. Below is my function to send the mail.
Public Shared Sub sendmail(ByVal strto As String, ByVal strfrom As String, ByVal strsub As String, ByVal strbody As String)
Dim objfrom As New MailAddress(strfrom)
Dim objto As New MailAddress(strto)
Dim objmail As New MailMessage(objfrom, objto)
objmail.Body = strbody
objmail.Subject = strsub
objmail.DeliveryNotificationOptions =DeliveryNotificationOptions.OnFailure
objmail.IsBodyHtml =TrueDim objsmtp As New SmtpClient()
objsmtp.Credentials =New System.Net.NetworkCredential("databaseadmin@log-ram.com", "&dmiN1")
objsmtp.Port = 25
objsmtp.Host ="smtp20a.serverdata.net"
objsmtp.Send(objmail)
End Sub
Wednesday, April 24, 2013 9:20 AM
Answers
-
User-1509636757 posted
Whatever it is, it is not a problem of your C# code, but a problem of your mail server.
but here are a couple of things I have seen:
* The SMTP server that tries to relay your email checks your IP address against your From address. If these won't match, it won't relay.
* It is usually the best to use the SMTP of your Internet Service Provider for sending emails.Reference Link: 'Transaction failed. The server response was: 5.7.1 Relay access denied in asp.net'
hope it helps./.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 25, 2013 7:33 AM -
User-1509636757 posted
Is it possible for you to try some other SMTP to send mail and all? If there is one of alternative to you; then you can check below links as well:
- Sending mail with Gmail Account using System.Net.Mail in ASP.NET - DotNetJalps
- Send Mail using Gmail - How to send email using ASP.NET : The Official Microsoft ASP.NET Forums
hope it helps./.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 25, 2013 7:41 AM
All replies
-
User-1509636757 posted
Probably your smtp server is not allowing to relay mail to outside domains. Have you tried to manually send to outside domain like yahoo, gmail?
Wednesday, April 24, 2013 10:45 AM -
User1243880387 posted
Make sure the host specified in the smtp host is valid for mails outside domain.
I faced the same issue when my host was limited in access.
Wednesday, April 24, 2013 11:06 AM -
User1357926729 posted
Probably your smtp server is not allowing to relay mail to outside domains.Can u tell me how to check whether my smtp server is allowing to relay mail to outside domains or not..and if not allowing,how to allow it?
I can send mails to outside domain manually.
Thursday, April 25, 2013 1:21 AM -
User1357926729 posted
Make sure the host specified in the smtp host is valid for mails outside domain.Can u please tell me how can i check whether the host specified in the smtp host is valid for mails outside the domain.
Thursday, April 25, 2013 1:28 AM -
User1357926729 posted
I am using windows 7 and when i checked my IIS manager,i cant find SMTP virtual server in it..how can i install and configure it?Some one help me please..
Thursday, April 25, 2013 1:56 AM -
User1243880387 posted
objsmtp.Host ="smtp20a.serverdata.net"From where you had written this?
Thursday, April 25, 2013 2:01 AM -
User1357926729 posted
"smtp20a.serverdata.net" this was the network host name in our company's existing website config file.In the website,Email need to be send only to the company mail ID's.Is the host name which is the reason for access denied error.
Thursday, April 25, 2013 3:58 AM -
User1357926729 posted
Some one please help me..i need to solve this issue so urgently..
Thursday, April 25, 2013 6:55 AM -
User-1509636757 posted
Whatever it is, it is not a problem of your C# code, but a problem of your mail server.
but here are a couple of things I have seen:
* The SMTP server that tries to relay your email checks your IP address against your From address. If these won't match, it won't relay.
* It is usually the best to use the SMTP of your Internet Service Provider for sending emails.Reference Link: 'Transaction failed. The server response was: 5.7.1 Relay access denied in asp.net'
hope it helps./.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 25, 2013 7:33 AM -
User-1509636757 posted
Is it possible for you to try some other SMTP to send mail and all? If there is one of alternative to you; then you can check below links as well:
- Sending mail with Gmail Account using System.Net.Mail in ASP.NET - DotNetJalps
- Send Mail using Gmail - How to send email using ASP.NET : The Official Microsoft ASP.NET Forums
hope it helps./.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 25, 2013 7:41 AM