Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
below is my code for feedback form in vb.net:

but gives error

<pre>mailbox unavailable. the server response was relay not permitted </pre>


pls help
thx in advance.

web.configfile
XML
<system.net>
    <mailSettings>

        <smtp from="feedback@gorwalyouthstar.co.in">
        <network host="smtp.net4india.com" port="25" userName="grtgrt"              password="fgfhgf"

      </smtp>
    </mailSettings>
  </system.net>






Protected Sub btnvsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnvsubmit.Click

       If Panel1.Visible = False Then
           Panel1.Visible = True
       End If


       Dim smtpClient As New SmtpClient()

       Dim MailMessage As New MailMessage()
       Dim EMail As MailMessage = New MailMessage()

       EMail.From = New MailAddress(txtvemail.Text)
       EMail.To.Add(New MailAddress("feedback@gorwalyouthstar.co.in"))

       EMail.Subject = "Feedback  " + txtvemail.Text
       EMail.Body = "Name: " + txtvname.Text + Environment.NewLine + "Email Id: " + txtvemail.Text + Environment.NewLine + "Country: " + txtvillage.Text + Environment.NewLine + "Message: " + txtvmsg.Text

       smtpClient.Host = "smtp.net4india.com" 'what is Smtp mail address '
       'smtpClient.EnableSsl = False
       smtpClient.Send(EMail)
       'smtpClient.Credentials = New System.Net.NetworkCredential("", "password")

       Try
           'smtpClient.Send(EMail)
           lblmsg.Text = "Thank you for sending us feedback!"
           txtvname.Text = ""
           txtvemail.Text = ""
           'ddlCountry.SelectedValue = "---Select---"
           txtvillage.Text = ""
           txtvmsg.Text = ""

       Catch exc As Exception
           Response.Write("Send failure: " & exc.ToString())
           lblmsg.Text = "Try Again .. Data is not save Successfully!"
       End Try






   End Sub
Posted
Updated 15-Apr-13 23:12pm
v2
Comments
ZurdoDev 16-Apr-13 11:32am    
You need to get with your SMTP admin.

1 solution

It usually means that you're not on the network that the SMTP server you're connect to is on. Normally ISPs block this to prevent people from outside their network from using their email servers to send spam.

You normally have to be inside the same network as the SMTP server you're trying to use.
 
Share this answer
 
Comments
petervanekeren 18-Apr-13 5:39am    
This is true.
Sometimes you can use a SMTP server while you're on a different network if you authenticate yourself.

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