Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 29th, 2004, 09:02 AM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Reply With Quote
  #2 (permalink)  
Old June 29th, 2004, 09:14 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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)
Reply With Quote
  #3 (permalink)  
Old July 1st, 2004, 12:31 AM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The error says 'Could not access 'CDO.Message' object.'


Reply With Quote
  #4 (permalink)  
Old July 1st, 2004, 01:54 AM
Friend of Wrox
 
Join Date: May 2004
Location: Ardabil, Ardabil, Iran.
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi it is some links that i think to help u .
http://www.aspheute.com/english/20000918.asp
Reply With Quote
  #5 (permalink)  
Old July 1st, 2004, 05:50 AM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?




Reply With Quote
  #6 (permalink)  
Old July 1st, 2004, 09:28 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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
Reply With Quote
  #7 (permalink)  
Old July 1st, 2004, 10:40 AM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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'?

Reply With Quote
  #8 (permalink)  
Old July 1st, 2004, 10:55 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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
Reply With Quote
  #9 (permalink)  
Old July 2nd, 2004, 06:13 AM
Registered User
 
Join Date: Jun 2004
Location: delhi, delhi, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to pawanagl Send a message via Yahoo to pawanagl
Default

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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 02: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 07:33 AM
Send email Danny_n BOOK: Excel 2003 VBA Programmer's Reference 0 January 12th, 2005 07:32 AM



All times are GMT -4. The time now is 01:12 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.