 |
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1).
** Please don't post code questions here **
For issues specific to a particular language in .NET, please see the other forum categories. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

June 29th, 2004, 09:02 AM
|
Authorized User
|
|
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
send email
Hi,
I tried to send email with these codes but there is a run time error when I tried to send the email. Is the problem related with the smtpserver?
Try
Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Message.To = "@yahoo.com"
Message.From = "a@yahoo.com"
Message.Subject = "nothing"
Message.Body = "nothing"
Try
Dim smtp As System.Web.Mail.SmtpMail
smtp.SmtpServer = "mail.i.net.au"
smtp.Send("a@yahoo.com", "a@yahoo.com", "n", "n")
'System.Web.Mail.SmtpMail.Send(Message)
Response.Write("success")
Catch
Response.Write("error") -> this error message was displayed
End Try
Catch
' Display usage instructions if error in arguments.
Response.Write("error2")
End Try
|

June 29th, 2004, 09:14 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
It's hard to say what the error is. How about catching the error exception and printing out the message so you can see the details?
Catch e As System.Exception
Response.Write(e.Message)
|

July 1st, 2004, 12:31 AM
|
Authorized User
|
|
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The error says 'Could not access 'CDO.Message' object.'
|

July 1st, 2004, 05:50 AM
|
Authorized User
|
|
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I just tried it at home (the first error was shown when I tried it at my school's PC). It said,
System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8004020F): The server rejected one or more recipient addresses. The server response was: 550 not local host yahoo.com, not a gateway --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject, String messageText) at System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText) at sandownregency.com.au.WebForm1.Page_Load(Object sender, EventArgs e)
what is exactly the fault?
|

July 1st, 2004, 09:28 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Quote:
quote:
The server rejected one or more recipient addresses. The server response was: 550 not local host yahoo.com, not a gateway
|
that's the exact fault. It's right there.... your email server is not a gateway at school and won't let you use a non-local email address.
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|

July 1st, 2004, 10:40 AM
|
Authorized User
|
|
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yea, i just figured it out. I tried to use my client's email as the receiver and it works(my client's email is on the mail server) (but I haven't checked whether my email was actually really sent, because I forgot my client's email password). Why does the server (mail.i.net.au) does not want to send any email outside its 'boundary'?
|

July 1st, 2004, 10:55 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Becuase it is configured correctly to prevent spammers from using it as a gateway to flood the internet with spam. If every email server was configured properly (like this) we would find the volume of spam would plummet.
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|

July 2nd, 2004, 06:13 AM
|
Registered User
|
|
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
I also got this problem. but this prob come due to access permission of your smtp server.
the program is unable to access the smtp server. so it's better to configure your local server and test it out.
your code is absolutely fine
No problem such as
pawan agarwal
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Need to send email |
garrettbrennan |
Visual C++ |
0 |
September 13th, 2007 12:24 PM |
How to send email |
abiye49 |
Excel VBA |
1 |
January 10th, 2007 03:32 PM |
Send by email |
tsimsha |
Classic ASP Databases |
1 |
October 1st, 2005 03:03 AM |
To send an email |
Danny_n |
BOOK: Excel 2003 VBA Programmer's Reference |
0 |
January 12th, 2005 08:33 AM |
Send email |
Danny_n |
BOOK: Excel 2003 VBA Programmer's Reference |
0 |
January 12th, 2005 08:32 AM |
|
 |