header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

We have a new sponsor!  Introducting Pragma Systems.  See the home page for details.

Send a mail through a lotus domino server using powershell
Last Post 26 Jan 2009 11: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 12:29 PM  
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.shawUser is Offline
Site Moderator
Advanced Member
Advanced Member
Posts:593
Avatar

--
23 Jan 2009 12:43 PM  
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 11: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.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 footer
footer