Send E-Mail from VB.Net 2003

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis

    Send E-Mail from VB.Net 2003

    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.Mai l' (requires reference to "System.Web.dll "),
    ''' delcare a new mail message
    Dim aMailMessage As New System.Web.Mail .MailMessage

    ''' set the from address
    aMailMessage.Fr om = myemail
    ''' set the to address and subject
    aMailMessage.To = toemail
    aMailMessage.Su bject = "Test Sending E-Mail from VB."

    ''' send in Text format
    aMailMessage.Bo dyFormat = System.Web.Mail .MailFormat.Tex t

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

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

    ''' send the email
    System.Web.Mail .SmtpMail.SmtpS erver = "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
  • Homer J Simpson

    #2
    Re: Send E-Mail from VB.Net 2003


    "Dennis" <Dennis@discuss ions.microsoft. com> wrote in message
    news:6A706A85-F3CE-4E72-A7DB-344222AB7345@mi crosoft.com...
    [color=blue]
    > 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.[/color]

    RoadRunner? Spam Central?



    Comment

    • Husam

      #3
      RE: Send E-Mail from VB.Net 2003

      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.SmtpS erver = "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



      Husam


      "Dennis" wrote:
      [color=blue]
      > 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.Mai l' (requires reference to "System.Web.dll "),
      > ''' delcare a new mail message
      > Dim aMailMessage As New System.Web.Mail .MailMessage
      >
      > ''' set the from address
      > aMailMessage.Fr om = myemail
      > ''' set the to address and subject
      > aMailMessage.To = toemail
      > aMailMessage.Su bject = "Test Sending E-Mail from VB."
      >
      > ''' send in Text format
      > aMailMessage.Bo dyFormat = System.Web.Mail .MailFormat.Tex t
      >
      > ''' set the body text
      > aMailMessage.Bo dy = "This is the text of the email message from
      > my test Program."
      >
      > ''' add an attachment if you want to
      > 'aMailMessage.A ttachments.Add( New
      > System.Web.Mail .MailAttachment ("C:Test.txt ",
      > System.Web.Mail .MailEncoding.B ase64))
      >
      > ''' send the email
      > System.Web.Mail .SmtpMail.SmtpS erver = "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[/color]

      Comment

      • Lucky

        #4
        Re: Send E-Mail from VB.Net 2003

        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

        Comment

        • Lucky

          #5
          Re: Send E-Mail from VB.Net 2003

          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.

          Comment

          • Lucky

            #6
            Re: Send E-Mail from VB.Net 2003

            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

            Comment

            • Dennis

              #7
              RE: Send E-Mail from VB.Net 2003

              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


              "Husam" wrote:
              [color=blue]
              > 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.SmtpS erver = "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:
              >[color=green]
              > > 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.Mai l' (requires reference to "System.Web.dll "),
              > > ''' delcare a new mail message
              > > Dim aMailMessage As New System.Web.Mail .MailMessage
              > >
              > > ''' set the from address
              > > aMailMessage.Fr om = myemail
              > > ''' set the to address and subject
              > > aMailMessage.To = toemail
              > > aMailMessage.Su bject = "Test Sending E-Mail from VB."
              > >
              > > ''' send in Text format
              > > aMailMessage.Bo dyFormat = System.Web.Mail .MailFormat.Tex t
              > >
              > > ''' set the body text
              > > aMailMessage.Bo dy = "This is the text of the email message from
              > > my test Program."
              > >
              > > ''' add an attachment if you want to
              > > 'aMailMessage.A ttachments.Add( New
              > > System.Web.Mail .MailAttachment ("C:Test.txt ",
              > > System.Web.Mail .MailEncoding.B ase64))
              > >
              > > ''' send the email
              > > System.Web.Mail .SmtpMail.SmtpS erver = "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[/color][/color]

              Comment

              • Lucky

                #8
                Re: Send E-Mail from VB.Net 2003

                check out this link, this might help u



                Comment

                • Walter CF

                  #9
                  Re: Send E-Mail from VB.Net 2003

                  Maybe you need authetication on your smtp server for example:
                  //using System.Web.Mail ;
                  eMail = new MailMessage();
                  eMail.BodyForma t = MailFormat.Text ;
                  eMail.From = _SendFrom;

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

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

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

                  eMail.Fields["http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e"]
                  = 1;

                  eMail.Fields["http://schemas.microso ft.com/cdo/configuration/sendusername"]
                  = "SMTPAUTHUs er";

                  eMail.Fields["http://schemas.microso ft.com/cdo/configuration/sendpassword"]
                  = "SMTPAUTHPasswo rd";
                  }
                  eMail.To = "recipients ";
                  SmtpMail.SmtpSe rver = SMTPServerName;
                  SmtpMail.Send(e Mail);
                  //
                  see this link:


                  Comment

                  • Cyril Gupta

                    #10
                    Re: Send E-Mail from VB.Net 2003

                    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


                    Comment

                    • Carlos J. Quintero [VB MVP]

                      #11
                      Re: Send E-Mail from VB.Net 2003

                      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:
                      MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.



                      "Cyril Gupta" <nomail@mail.co m> escribió en el mensaje
                      news:ufCtHalFGH A.3928@TK2MSFTN GP10.phx.gbl...[color=blue]
                      >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
                      >[/color]


                      Comment

                      Working...