Home All Groups Group Topic Archive Search About

Send E-Mail from VB.Net 2003

Author
9 Jan 2006 2:52 AM
Dennis
I am trying to send an e-mail using one of the examples I got on this group
as follows: (both toemail and myemail are valid e-mail addreses.

    'System.Web.Mail' (requires reference to "System.Web.dll"),
            ''' delcare a new mail message
            Dim aMailMessage As New System.Web.Mail.MailMessage

            ''' set the from address
            aMailMessage.From = myemail
            ''' set the to address and subject
            aMailMessage.To = toemail
            aMailMessage.Subject = "Test Sending E-Mail from VB."

            ''' send in Text format
            aMailMessage.BodyFormat = System.Web.Mail.MailFormat.Text

            ''' set the body text
            aMailMessage.Body = "This is the text of the email message from
my test Program."

            ''' add an attachment if you want to
            'aMailMessage.Attachments.Add(New
System.Web.Mail.MailAttachment("C:Test.txt",
System.Web.Mail.MailEncoding.Base64))

            ''' send the email
            System.Web.Mail.SmtpMail.SmtpServer = "smtp.sbcglobal.net"
            System.Web.Mail.SmtpMail.Send(aMailMessage)

I get an error message stating "Could not access CDO.Message Object.  Anyone
know what I'm doing wrong,  My e-mail is via RoadRunner Internet connection.
--
Dennis in Houston

Author
9 Jan 2006 3:52 AM
Homer J Simpson
"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:6A706A85-F3CE-4E72-A7DB-344222AB7345@microsoft.com...

> I get an error message stating "Could not access CDO.Message Object.
> Anyone
> know what I'm doing wrong,  My e-mail is via RoadRunner Internet
> connection.

RoadRunner? Spam Central?
Author
9 Jan 2006 4:11 AM
Husam
Hi Dennis:

I face the same problem three weeks ago so if your opreating system is
windows XP

do the following:
1\ go to control panel, then go to Administrative Tools , after that go to
something called Internet Information services IIS, if you did not find IIS
that mean you have to install this componant from windows XP CD.

2\ When you Open IIS go to the Local Computer and click plus sign you will
find
something called Default SMTP Virtual Server, right click and go to the
access tab
after that click relay button add IP address this one :"127.0.0.1" and set
System.Web.Mail.SmtpMail.SmtpServer = "127.0.0.1" and your problem will be
solved God willing, If you want more infromation about this error message
which is familire go to

http://www.systemwebmail.net/faq/4.2.3.aspx

Husam


Show quoteHide quote
"Dennis" wrote:

> I am trying to send an e-mail using one of the examples I got on this group
> as follows: (both toemail and myemail are valid e-mail addreses.
>
>     'System.Web.Mail' (requires reference to "System.Web.dll"),
>             ''' delcare a new mail message
>             Dim aMailMessage As New System.Web.Mail.MailMessage
>
>             ''' set the from address
>             aMailMessage.From = myemail
>             ''' set the to address and subject
>             aMailMessage.To = toemail
>             aMailMessage.Subject = "Test Sending E-Mail from VB."
>
>             ''' send in Text format
>             aMailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
>
>             ''' set the body text
>             aMailMessage.Body = "This is the text of the email message from
> my test Program."
>
>             ''' add an attachment if you want to
>             'aMailMessage.Attachments.Add(New
> System.Web.Mail.MailAttachment("C:Test.txt",
> System.Web.Mail.MailEncoding.Base64))
>
>             ''' send the email
>             System.Web.Mail.SmtpMail.SmtpServer = "smtp.sbcglobal.net"
>             System.Web.Mail.SmtpMail.Send(aMailMessage)
>
> I get an error message stating "Could not access CDO.Message Object.  Anyone
> know what I'm doing wrong,  My e-mail is via RoadRunner Internet connection.
> --
> Dennis in Houston
Author
9 Jan 2006 6:03 AM
Lucky
hi,
    i had this problem when i was learning mailing through vs2003.
right now i dont remember what i had done but i think i've updated my
OS with latest Service Pack available at Microsoft site and it started
working. also check that you have latest version on IIS on your pc. coz
it might also require for your programm.
Author
10 Jan 2006 12:37 AM
Dennis
Not everyone has IIs installed.  I want to send e-mail from my application
when the user clicks a button "Contact Us"' and the user may not have IIS
installed.

Isn't there a way to find the user's e-mail server and use that name?

--
Dennis in Houston


Show quoteHide quote
"Husam" wrote:

> Hi Dennis:
>
> I face the same problem three weeks ago so if your opreating system is
> windows XP
>
> do the following:
> 1\ go to control panel, then go to Administrative Tools , after that go to
> something called Internet Information services IIS, if you did not find IIS
> that mean you have to install this componant from windows XP CD.
>
> 2\ When you Open IIS go to the Local Computer and click plus sign you will
> find
> something called Default SMTP Virtual Server, right click and go to the
> access tab
> after that click relay button add IP address this one :"127.0.0.1" and set
> System.Web.Mail.SmtpMail.SmtpServer = "127.0.0.1" and your problem will be
> solved God willing, If you want more infromation about this error message
> which is familire go to
>
> http://www.systemwebmail.net/faq/4.2.3.aspx
>
> Husam
>
>
> "Dennis" wrote:
>
> > I am trying to send an e-mail using one of the examples I got on this group
> > as follows: (both toemail and myemail are valid e-mail addreses.
> >
> >     'System.Web.Mail' (requires reference to "System.Web.dll"),
> >             ''' delcare a new mail message
> >             Dim aMailMessage As New System.Web.Mail.MailMessage
> >
> >             ''' set the from address
> >             aMailMessage.From = myemail
> >             ''' set the to address and subject
> >             aMailMessage.To = toemail
> >             aMailMessage.Subject = "Test Sending E-Mail from VB."
> >
> >             ''' send in Text format
> >             aMailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
> >
> >             ''' set the body text
> >             aMailMessage.Body = "This is the text of the email message from
> > my test Program."
> >
> >             ''' add an attachment if you want to
> >             'aMailMessage.Attachments.Add(New
> > System.Web.Mail.MailAttachment("C:Test.txt",
> > System.Web.Mail.MailEncoding.Base64))
> >
> >             ''' send the email
> >             System.Web.Mail.SmtpMail.SmtpServer = "smtp.sbcglobal.net"
> >             System.Web.Mail.SmtpMail.Send(aMailMessage)
> >
> > I get an error message stating "Could not access CDO.Message Object.  Anyone
> > know what I'm doing wrong,  My e-mail is via RoadRunner Internet connection.
> > --
> > Dennis in Houston
Author
10 Jan 2006 9:00 AM
Lucky
check out this link, this might help u

http://www.systemwebmail.net/
Author
9 Jan 2006 6:05 AM
Lucky
hi,
    i had this problem when i was learning mailing through vs2003.
right now i dont remember what i had done but i think i've updated my
OS with latest Service Pack available at Microsoft site and it started
working. also check that you have latest version of IIS with latest
Service Pack on your pc. coz it might also require for your programm.

Lucky
Author
9 Jan 2006 6:20 AM
Lucky
hi,
    i had this problem when i was learning mailing through vs2003.
right now i dont remember what i had done but i think i've updated my
OS with latest Service Pack available at Microsoft site and it started
working. also check that you have latest version of IIS with latest
Service Pack on your pc. coz it might also require for your programm.

Lucky
Author
10 Jan 2006 7:30 PM
Walter CF
Maybe you need authetication on your smtp server for example:
//using System.Web.Mail;
    eMail = new MailMessage();
    eMail.BodyFormat = MailFormat.Text;
    eMail.From = _SendFrom;

eMail.Fields[http://schemas.microsoft.com/cdo/configuration/smtsperver]
     = "SMTPServerName";

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]
= 25;

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]
= 2;
    if (SMTPUser != null && SMTPPassword != null)
    {

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]
= 1;

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"]
=   "SMTPAUTHUser";

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"]
=   "SMTPAUTHPassword";
    }
    eMail.To = "recipients";
    SmtpMail.SmtpServer = SMTPServerName;
    SmtpMail.Send(eMail);
//
see this link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration.asp
Author
11 Jan 2006 2:26 AM
Cyril Gupta
I have heard that some SMTP servers won't let you send Email without a POP
transaction first. I think that is standard security in many servers to
prevent unauthorised people and spammers from using their servers. It is not
just SMTP authorisation which can solve your problem. My Email server does
this too.

So try logging into your POP mail before you try to send the mail through
SMTP. I think things will work for you.

Regards
Cyril
Author
11 Jan 2006 11:56 AM
Carlos J. Quintero [VB MVP]
Yes, there are 2 basic methods:

- SMTP authentication: you pass the user/password
- POP before SMTP: you need to pop messages first (to prove that you own the
account) and they you have a time window (30 minutes or so) to send
messages.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers:
http://www.mztools.com


Show quoteHide quote
"Cyril Gupta" <nom***@mail.com> escribió en el mensaje
news:ufCtHalFGHA.3928@TK2MSFTNGP10.phx.gbl...
>I have heard that some SMTP servers won't let you send Email without a POP
>transaction first. I think that is standard security in many servers to
>prevent unauthorised people and spammers from using their servers. It is
>not just SMTP authorisation which can solve your problem. My Email server
>does this too.
>
> So try logging into your POP mail before you try to send the mail through
> SMTP. I think things will work for you.
>
> Regards
> Cyril
>