header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Send a mail through a lotus domino server using powershell
Last Post 26 Jan 2009 03:12 AM by pakonukem. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
pakonukemUser is Offline
New Member
New Member
Posts:2
Avatar

--
23 Jan 2009 04:29 AM
    Hello,

    I'm trying to create and send a mail in a remote lotus domino server
    mail.box. I have created a working visual basic script for this, but in
    powershell i don't know how to call the "appenditemvalue" method for a lotus
    notes document object. Please, could you provide me any solution for this?
    Thanks!!

    (these are my source code for the scripts)l

    ---PS---
    $notes = New-Object -comobject Lotus.NotesSession
    $notes.initialize("Password")
    $maildb = $notes.GetDatabase("Server", "mail.box")
    if ($maildb.isopen)
    {$memodoc = $maildb.createdocument
    $memodoc.AppendItemValue("Form", "Memo")
    $memodoc.appenditemvalue("SendTo", "johnsmith@mailserver.com")
    $memodoc.appenditemvalue("Recipients", "johnsmith@mailserver.com")
    $memodoc.appenditemvalue("From", "petergriffin@mailserver.com")
    $memodoc.appenditemvalue("Principal", "petergriffin@mailserver.com")
    $memodoc.appenditemvalue("Subject", "My subject")
    $memodoc.save(True, False)
    $memodoc.Send(False)}


    ---VBS---
    Set session = CreateObject("Lotus.NotesSession")
    session.initialize("Password")
    Set maildb = session.GetDatabase("Server", "mail.box")
    If maildb.isopen Then
    Set memodoc = maildb.CreateDocument
    Call memodoc.AppendItemValue("Form", "Memo")
    Call memodoc.appenditemvalue("SendTo", "johnsmith@mailserver.com")
    Call memodoc.appenditemvalue("Recipients", "johnsmith@mailserver.com")
    Call memodoc.appenditemvalue("From", "petergriffin@mailserver.com")
    Call memodoc.appenditemvalue("Principal", "petergriffin@mailserver.com")
    Call memodoc.appenditemvalue("Subject", "My Subject")
    Call memodoc.save(True, False)
    Call memodoc.Send(False)
    End If
     
    Marco Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1641
    Avatar

    --
    23 Jan 2009 04:43 AM
    Are you getting any kind of error? Your syntax looks good (I don't have Lotus though).

    The only thing is the last 2 lines in PowerShell where you use "True" and "False", you should probably be using "$True" and "$False" (without using the quotes though) since that doesn't appear to be just a string field.
    Marco

    *Microsoft MVP - Windows PowerShell
    https://mvp.support.microsoft.com/profile/Marco.Shaw
    *Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
    *Blog - http://marcoshaw.blogspot.com
    pakonukemUser is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    26 Jan 2009 03:12 AM
    Thanks, you are right, it is also necessary this change for the document creation:

    $memodoc = $maildb.createdocument()
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer