Results 1 to 4 of 4

Thread: Sending an email via vb

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    24

    Sending an email via vb

    I wrote a vb script to back up a few files on my pc.

    I want it to send me and email when it is done telling me that the files have been backed up.

    I an using the following code and I am getting errors

    Dim objMessage
    Set objMessage = CreateObject("CDO.Message")
    If Err.number <> 0 then
    WScript.Quit Err.Number
    End If
    objMessage.Subject = "Test Message"
    objMessage.Sender = "[email protected]"
    objMessage.To = "[email protected]"
    objMessage.TextBody = "This is some sample message text."
    objMessage.Send

    Error: The "SendUsing" configuration value is invalid.

    What do I have to do to fix it. It works fine when I do this via asp on a web page but when I try to do the same thing via a script file, I get that error.

    Is there something else I have to add?

    Thanks,
    DL

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sending an email via vb

    Seems that you need to specify the smtp server?
    VB Code:
    1. SmtpMail.SmtpServer = "mail.your-domain.com"
    2.  
    3. By default, if SmtpMail.SmtpServer is not set, System.Web.Mail is supposed to use localhost as the default property.
    4. However, for some reason this doesn't appear work. If you are using the local SMTP Service to send emails, you may try the following values:
    5.  
    6. "127.0.0.1"
    7. "localhost"
    8. "the_machine_name_here"
    9. "the_real_dns_name_here"
    10. "the_machine_IP_Address_here"
    11. That should fix it.
    From this site here - http://www.systemwebmail.com/faq/4.2.2.aspx
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    New Member
    Join Date
    Jul 2003
    Location
    California
    Posts
    2

    Re: Sending an email via vb

    Why not just ShellExecute "mailto: your address"? That would open the default e-mail client (Eudora, Outlook, Outlook Express, or whatever the user has as their default client) to send the message.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sending an email via vb

    Because if the system doesnt have a email client it will brng up the Open With dialog box. Also, with Outlook it will invoke the Security Prompt dialog window before it is Sent.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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