Sign in to follow this  
Followers 0
gcue

generating an email with an attachment

4 posts in this topic

i am trying to generate (not send) an email with an attachment

currently, im using _inetmail but it doesnt provide an attachment option. i also saw Jos's awesome udf for sending an email using the smtp server settings.

i just want to create an email and attach a file - let the user type in recipient and click send

any ideas??

(using lotus notes)

many thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I use the following code for Outlook:

$oOApp = ObjCreate("Outlook.Application")
        $oOMail = $oOApp.CreateItem($olMailItem)
    
        With $oOMail
            .To = ($MailAn)
            .Subject = "blah blah"
            .BodyFormat = 2 ; $olFormatHTML
            .Importance = 2 ; $olImportanceHigh
            .HTMLBody = '<span style="font-family:Arial;font-size:10pt">' & _
                'The files in Directory' & _
                '<P><a href="file:///' & $Target & '">' & $Target & '</a>' & _
                '<P>have changedt.'
            .Display
;   .Send
        EndWith

I don't know if there is something similar for Notes.

Edit:

Searching the forum I found this.The mentioned IBM redbook "COM Togehter - with Domino" can be found here.

This post even has a script example.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

thanks for the response!

theres ObjCreate("Notes.NotesSession")

tried this but didnt work:

$oOApp = ObjCreate("Notes.Session")
        $oOMail = $oOApp.CreateItem($olMailItem)

        With $oOMail
            .To = ($MailAn)
            .Subject = "blah blah"
            .BodyFormat = 2 ; $olFormatHTML
            .Importance = 2 ; $olImportanceHigh
            .HTMLBody = '<span style="font-family:Arial;font-size:10pt">' & _
                'The files in Directory' & _
                '<P><a href="file:///' & $Target & '">' & $Target & '</a>' & _
                '<P>have changedt.'
            .Display
;   .Send
        EndWith
Edited by gcue

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

this worked =) (found a vbs script and converted it)

sends the email though =/ and mailfile has to be opened..

$oSession = ObjCreate("Notes.NotesSession")
$oCurrentMailDb = $oSession.CurrentDatabase

    ; Create a document in the back end

     $oMailDoc = $oCurrentMailDb.CREATEDOCUMENT
     $ortItem = $oMailDoc.CREATERICHTEXTITEM("Body")

    with $ortItem

        .AppendText("Here are the logs you requested for ")

;~         .AddNewLine(2)

;~         .AppendText("Please let me know if you need anything else.")

    EndWith


    $cstrAttachment = "c:\aclient.cfg"
    $blAttachment = 1

    If $blAttachment Then
         $ortAttacment = $oMailDoc.CREATERICHTEXTITEM("Attachment")

        ; Function EMBEDOBJECT(ByVal TYPE As Short, ByVal CLASS As String, ByVal SOURCE As String, Optional ByVal OBJECTNAME As Object = Nothing) As Object

        ; Member of lotus.NOTESRICHTEXTITEM

         $oEmbedObject = $ortAttacment.EMBEDOBJECT(1454, "", $cstrAttachment, "Attachment")
     EndIf
     
        With $oMailDoc
            .SendTo = "test@test.com"
            .Subject = "Logs for"
            .BodyFormat = 2 ; $olFormatHTML
;~             .Importance = 2 ; $olImportanceHigh
;~             .HTMLBody = '<span style="font-family:Arial;font-size:10pt">' & _
;~                 'The files in Directory' & _
;~              '<P><a href="file:///' & $Target & '">' & $Target & '</a>' & _
;~                 '<P>have changedt.'
            .Display
            .Send(0)
        EndWith
Edited by gcue

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0