473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sending Mail through SMTP in ASP.Net

mgpsivan
Hi
i'm trying to send mail to an gmail or yahoo id from an ASP.Net application by SMTP service using the following code..

Expand|Select|Wrap|Line Numbers
  1. Dim msg As New Net.Mail.MailMessage(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text)
  2.  
  3. Dim mySmtp As New Net.Mail.SmtpClient("IP ADDRESS")
  4. Try
  5. mySmtp.Send(msg)
  6. Label5.Text = "Mail Sent"
  7. Catch ex As Exception
  8. Label5.Text = ex.Message
  9. End Try
but it returns me the following error
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for toMAILID

Regards
Sivan.G
Sep 27 '07 #1
2 1371
Plater
7,872 Expert 4TB
SMTP servers will frequently reply that they "do not forward mail" when you have not correctly logged yourself in. Make sure that you are logging in with a valid set of user/password credentials

Also, if you are using gmail as your smtp server, make sure the account that you are using has pop/smtp access enabled in the settings (have to log into gmail.com to find them)
And yahoo doesn't allow pop/smtp access unles you have a paid account.
Sep 27 '07 #2
Frinavale
9,735 Expert Mod 8TB
Hi
i'm trying to send mail to an gmail or yahoo id from an ASP.Net application by SMTP service using the following code..

Expand|Select|Wrap|Line Numbers
  1. Dim msg As New Net.Mail.MailMessage(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text)
  2.  
  3. Dim mySmtp As New Net.Mail.SmtpClient("IP ADDRESS")
  4. Try
  5. mySmtp.Send(msg)
  6. Label5.Text = "Mail Sent"
  7. Catch ex As Exception
  8. Label5.Text = ex.Message
  9. End Try
but it returns me the following error
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for toMAILID

Regards
Sivan.G
Have you seen the Quick Reference on how to send an email in .NET?

Are you trying to connect to a gmail (or yahoo) account and send an email from their SMTP server there using your application?

Or are you connecting to another SMTP server and sending the email to a gmail or yahoo email address?

Please note that if you are using either the gmail or yahoo SMTP servers to send your emails, you will be require to provide credentials. Also, I think that the gmail SMTP server uses some sort of SSL and you have to take this into consideration.

-Frinny
Sep 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
6
by: Owen | last post by:
I am sending email using CDO but it only seems to work when the "To" address is within the same domain as mine. When I send to an outside domain (eg. yahoo.com) the mail simply does not reach...
9
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
3
by: armando perez | last post by:
Hi, this is my first time here, but I was looking for something that may help me, and still, I haven't found something to use. I'm using a website made in .NET with C#, when I'm running my site...
8
by: Robert Dufour | last post by:
Dim message As New MailMessage("mymail@mydomain.com", "mymail@mydomain.com", "Test", "Test") Dim emailClient As New SmtpClient("localhost") emailClient.Send(message) The IIS server is...
1
rsrinivasan
by: rsrinivasan | last post by:
Hi, I am Sending mail from java. When I run the program I hava Following error.. DEBUG: setDebug: JavaMail version 1.4ea DEBUG: getProvider() returning javax.mail.Provider DEBUG SMTP:...
2
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.