Results 1 to 12 of 12

Thread: How can you send an email with VB?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195

    How can you send an email with VB?

    anyone know?

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Use winsock control. Do a search on this forum, you should be able to find plenty of examples. if you cant then just PM me, i think i have one in my code library.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Are there any other ways without using Winsock?
    Don't Rate my posts.

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    You could use the Outlook Object in VB to send emails through VB.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Do u know of any examples using Outlook???
    Don't Rate my posts.

  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Add a refeerence to the Outlook object library.
    Place a button and name it cmdSend

    VB Code:
    1. Private Sub cmdSend_Click()
    2. Dim objOutlook As New Outlook.Application
    3. Dim objOutlookMsg As Outlook.MailItem
    4.  
    5. ' Create new message
    6. Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    7.  
    8. With objOutlookMsg
    9.     .To = "[email protected]"
    10.     .Subject = "Subjet here"
    11.     .Body = "Hello Danial, this is just a test msg"
    12.     .Importance = olImportanceHigh
    13.     .Send
    14. End With
    15.  
    16. Set objOutlookMsg = Nothing
    17. ' Close Outlook instance: Important!
    18. Set objOutlook = Nothing
    19.  
    20.  
    21. End Sub
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  7. #7
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    That code seems to work, but the emails ain't arriving in my inbox
    Don't Rate my posts.

  8. #8
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    check to see if your outlook is setup properly and set it so that when ever there is a new item in the outbox it should send it. I think if u look at your outbox you will see they are probably qued up there.

    BTW : what Outlook version are you using, if you are using XP then it will warn user of possible virus program trying to access their mail and will ask whether to allow access to outlook.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  9. #9
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Yeah, they were just sitting there. What exactly do I change?

    I'm using Outlook 97
    Don't Rate my posts.

  10. #10
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi,
    I am not sure i how set that in outlook 97, but it should be pretty similar. Go to email option and choose mail setup, there should be a check box, "Send Immediately when connected", check that and press ok. Now the email will be send as soo as you click the send button.

    Hope this helps.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  11. #11
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Nah, I'm going to have to set up Outlook Express, it doesn't have "Transport Provider". A waste of time. I'll just have to find another way of sending out an email.
    Don't Rate my posts.

  12. #12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width