Results 1 to 6 of 6

Thread: Sending mail from Word automation

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    3

    Sending mail from Word automation

    Hello everyone,


    From an acces database, I generate detailed MS Word documents, which are printed afterwards.

    A next step would be to automatically email the resulting documents to a fixed list of recipients, preferrably with "read receipt" option activated.

    In a later stadium, encryption of the email message would be required.

    Does anyone have some good pointers for me for good documentation or examples of this ? Can I use the Word.mailer for this ?

    Thank you,

    Phaedra

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Sending mail from Word automation

    What email program are you using? If Outlook you can create an Outlook object and use that to mail the Word docs as attachments.
    If the docs you email don't have to be the Word docs themselves, you can use SendObject in Access to email reports, which are in .rtf format, but SendObject doesn't support attachments.
    You could also use smtp (I think that's what it's called), but I've never used that.
    Tengo mas preguntas que contestas

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    3

    Re: Sending mail from Word automation

    Hello,

    I have experimented with the options you mentioned, but they are insufficient for my needs :

    - I don't want to save the generated document and send it as an attachment : I want to email it directly, in the body of the email message
    - the sendObject method doesn't allow you to fine-tune the email options as the Word.Mailer object.

    That's why I'm looking for documentation / examples / tips / .... about this object (or alternatives ?)

    Thanks,

    Phaedra

  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 mail from Word automation

    Something like this should get you started.
    VB Code:
    1. ActiveDocument.MailEnvelope.Item.Introduction = "Test"
    2.     With ActiveDocument.MailEnvelope.Item
    3.         .Recipients.Add "[email protected]"
    4.         .Subject = "Here is the document."
    5.         .Send
    6.     End With
    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

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    3

    Re: Sending mail from Word automation

    Thank you for the code in the last post, Rob.
    I got it working with that.

    From my Access db I create the Word document, which contains complex formatting.
    I then prepare the message parameters (recipients, subject, intro), after which I show the generated document (preview before sending), which contains a command button.

    Clicking this command buttond causes the document to be sent, after the button has deleted itself.

    The one thing I can't seem to find is how to set the message option to ask for a read receipt (Outlook is the default email program). Any ideas ?


    Thanks again, you've been a great help.

    Phaedra

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

    Re: Sending mail from Word automation

    I thought I may have done something with that before. Lets search for it on the Forums. Post the link if you find it beofre me.
    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