Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Help with SMTPMail


Message #1 by "Tony Arslan" <tarslan@n...> on Tue, 23 Apr 2002 16:25:51 -0500
Hello there,
I have written the following routine to send email through a Web Form.
It seems that it should work OK. But I get the following error. Can
someone help me please. I don't see an error here may be you could
HERE IS MY ROUTINE

Imports System.web.Mail


    Private Sub btnSendMail_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSendMail.Click
        'Create mail Message Object
        Dim objEmailMessage As New MailMessage()

        'Make sure we are using the local SMTP Server
        'SmtpMail.SmtpServer = ""

        'Here is the Email
        objEmailMessage.BodyFormat = MailFormat.Html
        objEmailMessage.Priority = MailPriority.High
        objEmailMessage.From = "tarslan@n..."
        objEmailMessage.To = "jklaasmeyer@n..."
        objEmailMessage.Cc = "tarslan@n..."
        objEmailMessage.Subject = "New Project Form"
        objEmailMessage.Body = "<html><body> <br><br>" _
                             & "Some Message. <br><br> " _
                             & "<br> Thank you " _
                             & " </body></html> "

        SmtpMail.Send(objEmailMessage)
    End Sub


HERE IS THE ERROR MESSAGE I GET:
"
The "SendUsing" configuration value is invalid. 
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code. 
Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid. 

Source Error: 
Line 49:         SmtpMail.Send(objEmailMessage)
Line 50:     End Sub
Line 51: End Class
[COMException (0x80040220): The "SendUsing" configuration value is
invalid.
"

Thanks in advance. Please reply to this message directly to
"tarslan@n..." if you can
Thanks again.
Tony

Message #2 by "William J Ryan" <wryan@u...> on Tue, 23 Apr 2002 16:44:00 -0500
Try uncommenting the following line and put the name of you smtp server
in the quotes.  I found that after moving from Beta2 to RTM that
defaulting to the localhost as the mail server no longer worked.  I was
just able to add in the netbios name of the server and it works fine
now.  (I'm assuming that your local host is running an smtp server)

'SmtpMail.SmtpServer =3D ""

Bill Ryan
wryan@u...

> -----Original Message-----
> From: Tony Arslan [mailto:tarslan@n...]
> Sent: Tuesday, April 23, 2002 4:26 PM
> To: ASP+
> Subject: [aspx] Help with SMTPMail
> Importance: High
>
>
> Hello there,
> I have written the following routine to send email through a
> Web Form. It seems that it should work OK. But I get the
> following error. Can someone help me please. I don't see an
> error here may be you could HERE IS MY ROUTINE
>
> Imports System.web.Mail
>
>
>     Private Sub btnSendMail_Click(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles btnSendMail.Click
>         'Create mail Message Object
>         Dim objEmailMessage As New MailMessage()
>
>         'Make sure we are using the local SMTP Server
>         'SmtpMail.SmtpServer =3D ""
>
>         'Here is the Email
>         objEmailMessage.BodyFormat =3D MailFormat.Html
>         objEmailMessage.Priority =3D MailPriority.High
>         objEmailMessage.From =3D "tarslan@n..."
>         objEmailMessage.To =3D "jklaasmeyer@n..."
>         objEmailMessage.Cc =3D "tarslan@n..."
>         objEmailMessage.Subject =3D "New Project Form"
>         objEmailMessage.Body =3D "<html><body> <br><br>" _
>                              & "Some Message. <br><br> " _
>                              & "<br> Thank you " _
>                              & " </body></html> "
>
>         SmtpMail.Send(objEmailMessage)
>     End Sub
>
>
> HERE IS THE ERROR MESSAGE I GET:
> "
> The "SendUsing" configuration value is invalid.
> Description: An unhandled exception occurred during the
> execution of the current web request. Please review the stack
> trace for more information about the error and where it
> originated in the code.
> Exception Details:
> System.Runtime.InteropServices.COMException: The "SendUsing"
> configuration value is invalid.
>
> Source Error:
> Line 49:         SmtpMail.Send(objEmailMessage)
> Line 50:     End Sub
> Line 51: End Class
> [COMException (0x80040220): The "SendUsing" configuration
> value is invalid. "
>
> Thanks in advance. Please reply to this message directly to
> "tarslan@n..." if you can Thanks again. Tony
>
>
>
Message #3 by "Gfw" <Gfw@y...> on Tue, 23 Apr 2002 17:03:44 -0500
Also take a look at http://dn.yyyz.net/DnYzArticleShow.aspx?WA=22 -
about 1/2 way down the page.

Gfw
mailto:Gfw@y...
http://yyyZ.Net 

-----Original Message-----
From: William J Ryan [mailto:wryan@u...] 
Sent: Tuesday, April 23, 2002 4:44 PM
To: ASP+
Subject: [aspx] RE: Help with SMTPMail


Try uncommenting the following line and put the name of you smtp server
in the quotes.  I found that after moving from Beta2 to RTM that
defaulting to the localhost as the mail server no longer worked.  I was
just able to add in the netbios name of the server and it works fine
now.  (I'm assuming that your local host is running an smtp server)

'SmtpMail.SmtpServer = ""

Bill Ryan
wryan@u...

> -----Original Message-----
> From: Tony Arslan [mailto:tarslan@n...]
> Sent: Tuesday, April 23, 2002 4:26 PM
> To: ASP+
> Subject: [aspx] Help with SMTPMail
> Importance: High
> 
> 
> Hello there,
> I have written the following routine to send email through a
> Web Form. It seems that it should work OK. But I get the 
> following error. Can someone help me please. I don't see an 
> error here may be you could HERE IS MY ROUTINE
> 
> Imports System.web.Mail
> 
> 
>     Private Sub btnSendMail_Click(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles btnSendMail.Click
>         'Create mail Message Object
>         Dim objEmailMessage As New MailMessage()
> 
>         'Make sure we are using the local SMTP Server
>         'SmtpMail.SmtpServer = ""
> 
>         'Here is the Email
>         objEmailMessage.BodyFormat = MailFormat.Html
>         objEmailMessage.Priority = MailPriority.High
>         objEmailMessage.From = "tarslan@n..."
>         objEmailMessage.To = "jklaasmeyer@n..."
>         objEmailMessage.Cc = "tarslan@n..."
>         objEmailMessage.Subject = "New Project Form"
>         objEmailMessage.Body = "<html><body> <br><br>" _
>                              & "Some Message. <br><br> " _
>                              & "<br> Thank you " _
>                              & " </body></html> "
> 
>         SmtpMail.Send(objEmailMessage)
>     End Sub
> 
> 
> HERE IS THE ERROR MESSAGE I GET:
> "
> The "SendUsing" configuration value is invalid.
> Description: An unhandled exception occurred during the 
> execution of the current web request. Please review the stack 
> trace for more information about the error and where it 
> originated in the code. 
> Exception Details: 
> System.Runtime.InteropServices.COMException: The "SendUsing" 
> configuration value is invalid. 
> 
> Source Error: 
> Line 49:         SmtpMail.Send(objEmailMessage)
> Line 50:     End Sub
> Line 51: End Class
> [COMException (0x80040220): The "SendUsing" configuration
> value is invalid. "
> 
> Thanks in advance. Please reply to this message directly to
> "tarslan@n..." if you can Thanks again. Tony
> 
> 
> 


Message #4 by irfan.syed@g... on Wed, 24 Apr 2002 09:51:26 +0800
This is a multipart message in MIME format.
--=_alternative 000A2E7E48256BA5_
Content-Type: text/plain; charset="us-ascii"

Well, here is how I send mail with final version of .Net. And it does not 
use Interop which definitely affects performance.
 
                Imports System.Web.Mail
                Dim myMessage As MailMessage, myMailer As SmtpMail
            Dim mailBody As String
 

            myMessage = New MailMessage()
            myMessage.From = "abc@x..."
            myMessage.Subject = "Test Subject"
            myMessage.Body = "Test Body"
            myMessage.BodyFormat = Web.Mail.MailFormat.Html
            myMailer.SmtpServer = "223.41.12.11"

            myMessage.To = "youremail@w..."
            myMailer.Send(myMessage)
 
            myMessage = Nothing
            myMailer = Nothing






"Tony Arslan" <tarslan@n...>
04/24/2002 05:25 AM
Please respond to "ASP+"

 
        To:     "ASP+" <aspx@p...>
        cc: 
        Subject:        [aspx] Help with SMTPMail


Hello there,
I have written the following routine to send email through a Web Form.
It seems that it should work OK. But I get the following error. Can
someone help me please. I don't see an error here may be you could
HERE IS MY ROUTINE

Imports System.web.Mail


Private Sub btnSendMail_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSendMail.Click
'Create mail Message Object
Dim objEmailMessage As New MailMessage()

'Make sure we are using the local SMTP Server
'SmtpMail.SmtpServer = ""

'Here is the Email
objEmailMessage.BodyFormat = MailFormat.Html
objEmailMessage.Priority = MailPriority.High
objEmailMessage.From = "tarslan@n..."
objEmailMessage.To = "jklaasmeyer@n..."
objEmailMessage.Cc = "tarslan@n..."
objEmailMessage.Subject = "New Project Form"
objEmailMessage.Body = "<html><body> <br><br>" _
& "Some Message. <br><br> " _
& "<br> Thank you " _
& " </body></html> "

SmtpMail.Send(objEmailMessage)
End Sub


HERE IS THE ERROR MESSAGE I GET:
"
The "SendUsing" configuration value is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid.

Source Error:
Line 49:         SmtpMail.Send(objEmailMessage)
Line 50:     End Sub
Line 51: End Class
[COMException (0x80040220): The "SendUsing" configuration value is
invalid.
"

Thanks in advance. Please reply to this message directly to
"tarslan@n..." if you can
Thanks again.
Tony





This e-mail (and any attachment (s)) is confidential and for use only by
intended recipient (s). Access by others is unauthorised. Its content
should not be relied upon and no liability or responsibility is accepted by
us, without our subsequent written confirmation of its content. If you are
not an intended recipient, please notify us promptly and delete all copies
and note that any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on the information it contains is
prohibited and may be unlawful. Further information on Guoco Group is
available from http://www.guoco.com


Message #5 by Janus Pienaar <Janus@i...> on Wed, 24 Apr 2002 08:58:46 +0200
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1EB5D.7A5A51F0
Content-Type: text/plain;
	charset="iso-8859-1"

If I use this code to send Mail, I get the Following error:
 
" Could not access 'CDO.Message' object."
 
Can anyone pls help with this????

                
                Imports System.Web.Mail 
                Dim myMessage As MailMessage, myMailer As SmtpMail 
            Dim mailBody As String 
            

            myMessage = New MailMessage() 
            myMessage.From = "abc@x..." 
            myMessage.Subject = "Test Subject" 
            myMessage.Body = "Test Body" 
            myMessage.BodyFormat = Web.Mail.MailFormat.Html 
            myMailer.SmtpServer = "223.41.12.11" 

            myMessage.To = "youremail@w..." 
            myMailer.Send(myMessage) 
            
            myMessage = Nothing 
            myMailer = Nothing 





	"Tony Arslan" <tarslan@n...> 


04/24/2002 05:25 AM 
Please respond to "ASP+" 


        
        To:        "ASP+" <aspx@p...> 
        cc:         
        Subject:        [aspx] Help with SMTPMail



Hello there,
I have written the following routine to send email through a Web Form.
It seems that it should work OK. But I get the following error. Can
someone help me please. I don't see an error here may be you could
HERE IS MY ROUTINE

Imports System.web.Mail


Private Sub btnSendMail_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSendMail.Click 
'Create mail Message Object
Dim objEmailMessage As New MailMessage() 

'Make sure we are using the local SMTP Server
'SmtpMail.SmtpServer = "" 

'Here is the Email
objEmailMessage.BodyFormat = MailFormat.Html
objEmailMessage.Priority = MailPriority.High
objEmailMessage.From = "tarslan@n..."
objEmailMessage.To = "jklaasmeyer@n..."
objEmailMessage.Cc = "tarslan@n..."
objEmailMessage.Subject = "New Project Form"
objEmailMessage.Body = "<html><body> <br><br>" _ 
& "Some Message. <br><br> " _
& "<br> Thank you " _
& " </body></html> " 

SmtpMail.Send(objEmailMessage)
End Sub 


HERE IS THE ERROR MESSAGE I GET:
"
The "SendUsing" configuration value is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid.

Source Error:
Line 49:         SmtpMail.Send(objEmailMessage)
Line 50:     End Sub
Line 51: End Class
[COMException (0x80040220): The "SendUsing" configuration value is
invalid.
"

Thanks in advance. Please reply to this message directly to
"tarslan@n..." if you can
Thanks again.
Tony





This e-mail (and any attachment (s)) is confidential and for use only by
intended recipient (s). Access by others is unauthorised. Its content
should not be relied upon and no liability or responsibility is accepted by
us, without our subsequent written confirmation of its content. If you are
not an intended recipient, please notify us promptly and delete all copies
and note that any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on the information it contains is
prohibited and may be unlawful. Further information on Guoco Group is
available from http://www.guoco.com
--- Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 

Everything in this e-mail and any attachments relating to the official
business of Isonet ZA is proprietary to the company. It is confidential,
legally privileged and protected by law. Isonet ZA does not own and endorse
any other content. Views and opinions are those of the sender unless clearly
stated as being that of Isonet ZA. The person addressed in the e-mail is the
sole authorised recipient. Please notify the sender immediately if it has
unintentionally reached you and do not read, disclose or use the content in
any way. Isonet ZA cannot assure that the integrity of this communication
has been maintained nor that it is free of errors, virus, interception or
interference.

Message #6 by "Minh T. Nguyen" <nguyentriminh@y...> on Wed, 24 Apr 2002 00:45:06 -0700
Hi,

	You gotta set the mail server as in:
	SmtpMail.SmtpServer = "mail.mailserver.com"

	If it still fails, then make sure that the mailserver you are
using allows you to send an email from "abc@x...". Most of the mail
servers only allow emails to come from an email address from the same
domain.

Minh.

-----Original Message-----
From: Janus Pienaar [mailto:Janus@i...] 
Sent: Tuesday, April 23, 2002 11:59 PM
To: ASP+
Subject: [aspx] Re: Help with SMTPMail


If I use this code to send Mail, I get the Following error:

" Could not access 'CDO.Message' object."

Can anyone pls help with this????
                
                Imports System.Web.Mail 
                Dim myMessage As MailMessage, myMailer As SmtpMail 
            Dim mailBody As String 
            

            myMessage = New MailMessage() 
            myMessage.From = "abc@x..." 
            myMessage.Subject = "Test Subject" 
            myMessage.Body = "Test Body" 
            myMessage.BodyFormat = Web.Mail.MailFormat.Html 
            myMailer.SmtpServer = "223.41.12.11" 

            myMessage.To = "youremail@w..." 
            myMailer.Send(myMessage) 
            
            myMessage = Nothing 
            myMailer = Nothing 



Message #7 by Mindy Leslie <mindyjeanne@y...> on Wed, 24 Apr 2002 16:22:55 -0700 (PDT)
--0-1255332024-1019690575=:52895
Content-Type: text/plain; charset=us-ascii


 I tried that and it didn't work, this does..but it's written in C#.

MailMessage myMessage;

string mailBody;

SmtpMail myMailer; 

myMessage = new MailMessage();

myMessage.From = "abc@x..." ;

myMessage.Subject = "Test Subject"; 

myMessage.Body = "Test Body" ;

myMessage.BodyFormat = System.Web.Mail.MailFormat.Text ; 

myMessage.To = "mindyjeanne@y..." ; 

System.Web.Mail.SmtpMail.Send(myMessage ); 

myMessage = null;

myMailer = null ;

 

Check out the following article:

http://www.mastercsharp.com/article.aspx?ArticleID=61&&TopicID=2

  "Minh T. Nguyen" <nguyentriminh@y...> wrote: Hi,

You gotta set the mail server as in:
SmtpMail.SmtpServer = "mail.mailserver.com"

If it still fails, then make sure that the mailserver you are
using allows you to send an email from "abc@x...". Most of the mail
servers only allow emails to come from an email address from the same
domain.

Minh.

-----Original Message-----
From: Janus Pienaar [mailto:Janus@i...] 
Sent: Tuesday, April 23, 2002 11:59 PM
To: ASP+
Subject: [aspx] Re: Help with SMTPMail


If I use this code to send Mail, I get the Following error:

" Could not access 'CDO.Message' object."

Can anyone pls help with this????

Imports System.Web.Mail 
Dim myMessage As MailMessage, myMailer As SmtpMail 
Dim mailBody As String 


myMessage = New MailMessage() 
myMessage.From = "abc@x..." 
myMessage.Subject = "Test Subject" 
myMessage.Body = "Test Body" 
myMessage.BodyFormat = Web.Mail.MailFormat.Html 
myMailer.SmtpServer = "223.41.12.11" 

myMessage.To = "youremail@w..." 
myMailer.Send(myMessage) 

myMessage = Nothing 
myMailer = Nothing 






---------------------------------
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
Message #8 by "Minh T. Nguyen" <nguyentriminh@y...> on Wed, 24 Apr 2002 16:40:52 -0700
Mindy,

    Are you saying that the following example works in C#, but when
translated to VB.NET it doesn't? Wow! That is really weird. Again, I see
that you do not have set a mail server, so by default it is supposed to
use your localhost mailserver. Your localhost mailserver doesn't know
that this code is called from VB.NET or C#!
    Also, the mailserver you are using has to allow sending messages
from mindyjeanne@y... Not all mail servers do, and most of them
actually don't. I don't know about the mailserver that is installed on
your system. It's probably best if you set it to mail.smtp.yahoo.com,
but Yahoo allows this only if you have subscribed to the $20/year POP3
service. But hey, you can give it a try.

Minh.

-----Original Message-----
From: Mindy Leslie [mailto:mindyjeanne@y...] 
Sent: Wednesday, April 24, 2002 4:23 PM
To: ASP+
Subject: [aspx] Re: Help with SMTPMail


I tried that and it didn't work, this does..but it's written in C#.
MailMessage myMessage;
string mailBody;
SmtpMail myMailer; 
myMessage = new MailMessage();
myMessage.From = "abc@x..." ;
myMessage.Subject = "Test Subject"; 
myMessage.Body = "Test Body" ;
myMessage.BodyFormat = System.Web.Mail.MailFormat.Text ; 
myMessage.To = "mindyjeanne@y..." ; 
System.Web.Mail.SmtpMail.Send(myMessage ); 
myMessage = null;
myMailer = null ;

Check out the following article:
http://www.mastercsharp.com/article.aspx?ArticleID=61&&TopicID=2
  "Minh T. Nguyen" <nguyentriminh@y...> wrote: 
Hi,

You gotta set the mail server as in:
SmtpMail.SmtpServer = "mail.mailserver.com"

If it still fails, then make sure that the mailserver you are
using allows you to send an email from "abc@x...". Most of the mail
servers only allow emails to come from an email address from the same
domain.

Minh.

Message #9 by Mindy Leslie <mindyjeanne@y...> on Wed, 24 Apr 2002 16:48:18 -0700 (PDT)
--0-1100673433-1019692098=:37206
Content-Type: text/plain; charset=us-ascii


 oops, sorry to confuse you.  I translated the code originally sent in to C#( code behind for ASP app ). It wouldn't compile.  
To access send and smptserver attributes I needed to prefix:

System.Web.Mail.SmtpMail  so it was 

System.Web.Mail.SmtpMail.Send(myMessage )

I also didn't need to set the smtpserver attribute( property ). At least not from my home.

Since this will be working from my Work Site..with firewall, i may need that extra line of code.

( this is my first time, utilizing anything to do with SMTP. ) Actually, I'm quite new to .NET 

Mindy Jeanne Leslie

 

  "Minh T. Nguyen" <nguyentriminh@y...> wrote: Mindy,

Are you saying that the following example works in C#, but when
translated to VB.NET it doesn't? Wow! That is really weird. Again, I see
that you do not have set a mail server, so by default it is supposed to
use your localhost mailserver. Your localhost mailserver doesn't know
that this code is called from VB.NET or C#!
Also, the mailserver you are using has to allow sending messages
from mindyjeanne@y... Not all mail servers do, and most of them
actually don't. I don't know about the mailserver that is installed on
your system. It's probably best if you set it to mail.smtp.yahoo.com,
but Yahoo allows this only if you have subscribed to the $20/year POP3
service. But hey, you can give it a try.

Minh.

-----Original Message-----
From: Mindy Leslie [mailto:mindyjeanne@y...] 
Sent: Wednesday, April 24, 2002 4:23 PM
To: ASP+
Subject: [aspx] Re: Help with SMTPMail


I tried that and it didn't work, this does..but it's written in C#.
MailMessage myMessage;
string mailBody;
SmtpMail myMailer; 
myMessage = new MailMessage();
myMessage.From = "abc@x..." ;
myMessage.Subject = "Test Subject"; 
myMessage.Body = "Test Body" ;
myMessage.BodyFormat = System.Web.Mail.MailFormat.Text ; 
myMessage.To = "mindyjeanne@y..." ; 
System.Web.Mail.SmtpMail.Send(myMessage ); 
myMessage = null;
myMailer = null ;

Check out the following article:
http://www.mastercsharp.com/article.aspx?ArticleID=61&&TopicID=2
"Minh T. Nguyen" wrote: 
Hi,

You gotta set the mail server as in:
SmtpMail.SmtpServer = "mail.mailserver.com"

If it still fails, then make sure that the mailserver you are
using allows you to send an email from "abc@x...". Most of the mail
servers only allow emails to come from an email address from the same
domain.

Minh.




---------------------------------
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
Message #10 by "Minh T. Nguyen" <nguyentriminh@y...> on Wed, 24 Apr 2002 17:00:15 -0700
Mindy,

	Oh, I see. You can by the way set an import/using statement at
the top of your code, this way you don't have to prefix everything:

	C#:
	using System.Web.Mail;

	VB.NET:
	Imports System.Web.Mail

Have fun,
Minh.

-----Original Message-----
From: Mindy Leslie [mailto:mindyjeanne@y...] 
Sent: Wednesday, April 24, 2002 4:48 PM
To: ASP+
Subject: [aspx] Re: Help with SMTPMail


oops, sorry to confuse you.  I translated the code originally sent in to
C#( code behind for ASP app ). It wouldn't compile.  
To access send and smptserver attributes I needed to prefix:
System.Web.Mail.SmtpMail  so it was 
System.Web.Mail.SmtpMail.Send(myMessage )
I also didn't need to set the smtpserver attribute( property ). At least
not from my home.
Since this will be working from my Work Site..with firewall, i may need
that extra line of code.
( this is my first time, utilizing anything to do with SMTP. ) Actually,
I'm quite new to .NET 
Mindy Jeanne Leslie

Message #11 by Mindy Leslie <mindyjeanne@y...> on Wed, 24 Apr 2002 17:12:13 -0700 (PDT)
--0-2081989120-1019693533=:43787
Content-Type: text/plain; charset=us-ascii


 Yeah, I have that, you get the following message without the prefix in C#
Static member 'System.Web.Mail.SmtpMail.Send(System.Web.Mail.MailMessage)' cannot be accessed with an instance reference; qualify it
with a type name instead

I only need the prefix for the Send ( member ) and SmtpServer( property )

Thanx

Mindy Jeanne


  "Minh T. Nguyen" <nguyentriminh@y...> wrote: Mindy,

Oh, I see. You can by the way set an import/using statement at
the top of your code, this way you don't have to prefix everything:

C#:
using System.Web.Mail;

VB.NET:
Imports System.Web.Mail

Have fun,
Minh.

-----Original Message-----
From: Mindy Leslie [mailto:mindyjeanne@y...] 
Sent: Wednesday, April 24, 2002 4:48 PM
To: ASP+
Subject: [aspx] Re: Help with SMTPMail


oops, sorry to confuse you. I translated the code originally sent in to
C#( code behind for ASP app ). It wouldn't compile. 
To access send and smptserver attributes I needed to prefix:
System.Web.Mail.SmtpMail so it was 
System.Web.Mail.SmtpMail.Send(myMessage )
I also didn't need to set the smtpserver attribute( property ). At least
not from my home.
Since this will be working from my Work Site..with firewall, i may need
that extra line of code.
( this is my first time, utilizing anything to do with SMTP. ) Actually,
I'm quite new to .NET 
Mindy Jeanne Leslie




---------------------------------
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
Message #12 by "Philip Goatly" <philip.goatly@b...> on Thu, 25 Apr 2002 09:36:04 +0100
This is a multi-part message in MIME format.

------=_NextPart_000_0041_01C1EC3C.9E6003D0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Mindy,

   I think you willneed to tell it the name of your SMPTmail server.

e.g.  
SmtpMail.SmtpServer =3D "MailServer.xyz.net"



Cheers, Phil

  ----- Original Message -----
  From: Mindy Leslie
  To: ASP+
  Sent: Thursday, April 25, 2002 12:22 AM
  Subject: [aspx] Re: Help with SMTPMail


  I tried that and it didn't work, this does..but it's written in C#.

  MailMessage myMessage;

  string mailBody;

  SmtpMail myMailer;

  myMessage =3D new MailMessage();

  myMessage.From =3D "abc@x..." ;

  myMessage.Subject =3D "Test Subject";

  myMessage.Body =3D "Test Body" ;

  myMessage.BodyFormat =3D System.Web.Mail.MailFormat.Text ;

  myMessage.To =3D "mindyjeanne@y..." ;

  System.Web.Mail.SmtpMail.Send(myMessage );

  myMessage =3D null;

  myMailer =3D null ;



  Check out the following article:

  http://www.mastercsharp.com/article.aspx?ArticleID=3D61&&TopicID=3D2

    "Minh T. Nguyen" <nguyentriminh@y...> wrote:

    Hi,

    You gotta set the mail server as in:
    SmtpMail.SmtpServer =3D "mail.mailserver.com"

    If it still fails, then make sure that the mailserver you are
    using allows you to send an email from "abc@x...". Most of the 
mail
    servers only allow emails to come from an email address from the 
same
    domain.

    Minh.

    -----Original Message-----
    From: Janus Pienaar [mailto:Janus@i...]
    Sent: Tuesday, April 23, 2002 11:59 PM
    To: ASP+
    Subject: [aspx] Re: Help with SMTPMail


    If I use this code to send Mail, I get the Following error:

    " Could not access 'CDO.Message' object."

    Can anyone pls help with this????

    Imports System.Web.Mail
    Dim myMessage As MailMessage, myMailer As SmtpMail
    Dim mailBody As String


    myMessage =3D New MailMessage()
    myMessage.From =3D "abc@x..."
    myMessage.Subject =3D "Test Subject"
    myMessage.Body =3D "Test Body"
    myMessage.BodyFormat =3D Web.Mail.MailFormat.Html
    myMailer.SmtpServer =3D "223.41.12.11"

    myMessage.To =3D "youremail@w..."
    myMailer.Send(myMessage)

    myMessage =3D Nothing
    myMailer =3D Nothing








-------------------------------------------------------------------------
-----
  Do You Yahoo!?
  Yahoo! Games - play chess, backgammon, pool and more --- Change your 
mail options at http://p2p.wrox.com/manager.asp or to unsubscribe send a 
blank email to 


_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service.


  Return to Index