Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I am facing this issue to send email from my website to linked mail account.

User not local; please try a different path. The server response was: Sender address is not valid for your login.

Check your email program settings.
VB
Exception Details: System.Net.Mail.SmtpException: User not local; please try a different path. The server response was: Sender address is not valid for your login. Check your email program settings.



Line 21:         'send the message
Line 22:         Dim smtp As New SmtpClient("mail.dadaremoval.com.au")
Line 23:         smtp.Send(mail)
Line 24: 
Line 25:         'Response.Redirect("thanks.htm", False)

ITS SHOWING THE ERROR ON LINE 23

I am using this code to send email.
VB
'set the addresses
        mail.From = New MailAddress(Me.email.Text)
        mail.To.Add()

        'set the content
        mail.Subject = "Online booking"
        mail.Body = "Hi"
        ' mail.Body = "Hi, you got Job. Here are the details of booking  " & vbCrLf & " " & vbCrLf & "Passenger name: " + Me.nameTextBox.Text + "" & vbCrLf & "" & vbCrLf & "  Phone number: " + Me.phoneTextBox.Text + "" & vbCrLf & " " & vbCrLf & "Booking date: " + Me.booking.Text & vbCrLf & "Email: " + Me.email.Text + "" & vbCrLf & "" & vbCrLf & "" & vbCrLf & "Passenger Pick-up details" & vbCrLf & "  Unit/Flat numder: " + Me.unitTextBox.Text + "" & vbCrLf & " " & vbCrLf & "Street number: " + Me.stnumberTextBox.Text + "" & vbCrLf & "" & vbCrLf & " Street Name: " + Me.stnameTextBox.Text + "" & vbCrLf & " " & vbCrLf & "Suburb: " + Me.sbdrop.SelectedValue + "" & vbCrLf & "" & vbCrLf & " Building type: " + Me.radio1.SelectedValue + "" & vbCrLf & " " & vbCrLf & "" & vbCrLf & "Passenger destination" & vbCrLf & "  Unit/Flat numder: " + Me.unit1.Text + "" & vbCrLf & " " & vbCrLf & "Street number: " + Me.stnumber1.Text + "" & vbCrLf & "" & vbCrLf & " Street Name: " + Me.stname1.Text + "" & vbCrLf & " " & vbCrLf & "Suburb: " + Me.sbdrop1.SelectedValue + "" & vbCrLf & "" & vbCrLf & "Building type:" + Me.radio1.SelectedValue + "" & vbCrLf & "" & vbCrLf & "" + "Have a Nice Day ! "

        'send the message
        Dim smtp As New SmtpClient("50.22.16.2")
        smtp.Send(mail)

Please help me to solve this issue.

Thanks
Posted
Updated 22-Dec-11 20:05pm
v4
Comments
Nigam Patel 22-Dec-11 2:56am    
did you use your local SMTP server ?
Peta2010 22-Dec-11 4:02am    
anyone can solve my issue????
Nigam Patel 22-Dec-11 23:16pm    
as per your Error message your host address is wrong. please re-check your SMTP mail Address for sending email
.

Quote:
mail.From = New MailAddress(Me.email.Text)
mail.To.Add()


The Problem is with "from", here you are using text box to add from address so it is not valid in your smtp domain please specify user name and password for login for smtp client
 
Share this answer
 
Comments
Peta2010 21-Dec-11 23:00pm    
I am still facing the same error. in my web config file i have added username and password for email. But it still not working.

Could you please tell me i need to add that email address where i want to send email or an extra email apart from receiving email ?
 
Share this answer
 
This is in C# check similar for VB

System.Net.Mail.MailMessage Message = new System.Net.Mail.MailMessage();
  Message.From = new System.Net.Mail.MailAddress(FromId));



I think this should solve your Problem


Or else check the smtp server settings
 
Share this answer
 
v4
Comments
Peta2010 22-Dec-11 1:09am    
still not working
Hi
Please try this link

http://developerszone.vining.in/user-not-local-please-try-a-different-path-the-server-response-was-sender-address-is-not-valid/

Thanks
Nilesh P. Chauhan
(Director)
http://www.vining.in
http://www.viningwebstyle.com
 
Share this answer
 
Comments
[no name] 22-Jun-13 12:11pm    
After 8 years you should have more sense than to answer ancient questions for no other reason than to drive traffic to your own website.

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