Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 04 JUN 2010 07:06:45AM Bill North wrote:

I know this is not an OI support issue, but I had a vbscript which allowed me to send an email using the Lotus Notes client but this does not seem to work in version 8.5 would anyone have any ideas? another way of doing this in OI?


At 04 JUN 2010 10:03AM Bob Carten wrote:

Hi Bill,

I've been using this in OI 8.x for a while.

IIRC There can be minor differences depending on the version.

This runs on a desktop using the currently logged in user's credentials.

HTH

- Bob

0001  Function SendNotesEmail(inRecipients, insubj, inbdy, inAttachments, inCCs)
0002  /*
0003  //**************************************
0004  // Name: A++ Send Lotus Notes Email VBS S
0005  //     cript
0006  // Description:Simple script to send a Lo
0007  //     tus Notes email. Can be modified to auto
0008  //     mate tasks on the server.
0009  // By: Steven Jacobs
0010  //
0011  //This code is copyrighted and has limited warranties
0012  // see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=8815&lngWId=4
0013  **************************************
0014  
0015  06-06-07   rjc   Translated to OI
0016  
0017  */
0018  
0019  
0020  $insert Logical
0021  $insert Msg_equates
0022  
0023  equ crlf$ to \0D0A\
0024  
0025  recipients = if assigned(inRecipients) then  inRecipients else ''
0026  subj = if assigned(inSubj) then inSubj else ''
0027  bdy  = if assigned(inBdy) then inBdy else ''
0028  attachments = if assigned( inattachments ) then inattachments else ''
0029  ccs = if assigned( inccs ) then inccs else ''
0030  err = ''
0031  
0032  if recipients = '' then err := '- Recipent required '
0033  if subj = '' then err := '- Subject required '
0034  if bdy = '' then err := '- Body Required'
0035  
0036  if err then
0037     GoTo ErrorHandler
0038  end
0039  
0040  fs = OleCreateInstance("Scripting.FileSystemObject")
0041  if OleStatus() then
0042     err = "Could Not Create FileSystemObject"
0043     GoTo ErrorHandler
0044  end
0045  
0046  
0047  col = ''
0048  exists = true$
0049  loop
0050     remove Attachment from attachments at col setting mark
0051     if attachment # '' then
0052        exists = ( dir(inAttachments)<1> > 0 )
0053        if exists else
0054           err = 'Invalid Attachment ' : attachment
0055           GoTo ErrorHandler
0056        end
0057     end
0058  while Exists
0059  while mark
0060  repeat
0061  
0062  formatted_recips = ''
0063  col = ''
0064  loop
0065     remove item from recipients at col setting mark
0066     test = index(item, '@', 1)
0067     if test then
0068        begin case
0069           case count(item, ' ')
0070           case count(item, '<')
0071           case otherwise$
0072               item = '<' : item : '>'
0073        end case   
0074        formatted_recips<-1> = item
0075     end
0076  while mark
0077  repeat
0078  convert @fm to ';' in formatted_recips
0079  
0080  formatted_ccs = ''
0081  col = ''
0082  loop
0083     remove item from ccs at col setting mark
0084     test = index(item, '@', 1)
0085     if test then
0086        begin case
0087           case count(item, ' ')
0088           case count(item, '<')
0089           case otherwise$
0090               item = '<' : item : '>'
0091        end case   
0092        formatted_ccs<-1> = item
0093     end
0094  while mark
0095  repeat
0096  convert @fm to ';' in formatted_ccs
0097  
0098  if err then
0099     return ''
0100  end
0101  
0102  s = OleCreateInstance("Notes.NotesSession")
0103  If OleStatus() then
0104     err = "Could Not Create A Session Of Notes."
0105     GoTo ErrorHandler
0106  end
0107  
0108  mailserver = s->getenvironmentstring("MailServer",true$)
0109  mailfile = s->getenvironmentstring("Mailfile",true$)
0110  db = s->getdatabase(mailserver, Mailfile )
0111  if oleStatus() then
0112     err = 'Could find or Get a handle on the mail file'
0113     GoTo ErrorHandler
0114  end
0115  
0116  doc = db->createdocument()
0117  rtitem = doc->createrichtextitem("BODY")
0118  doc->form = "Memo"
0119  doc->subject = subj
0120  doc->sendto = formatted_recips
0121  if formatted_ccs # '' then
0122     doc->copyto = formatted_ccs
0123  end   
0124  doc->body = bdy
0125  //doc->postdate=date()
0126  
0127  col = ''
0128  loop
0129     remove attachment from attachments at col setting mark
0130     if attachment # '' then
0131        x =  rtitem->embedobject(1454,"",Attachment)
0132     end
0133  while mark
0134  repeat
0135  
0136  doc->visible = True$
0137  s = doc->send(False$)
0138  GoSub Cleanup
0139  def = ''
0140  def<mCaption$> = "Message Sent Notification."
0141  def<mIcon$> = 'I'
0142  def<mText$> = "Your message has been created and sent." : crlf$ :"Thank you."
0143  msg(@window, def)
0144  
0145  return ''
0146  
0147  ErrorHandler:
0148  GoSub Cleanup
0149  Msg(@window, err)
0150  return ''
0151  
0152  
0153  CleanUp:
0154  s = ''
0155  db = ''
0156  doc = ''
0157  rtitem = ''
0158  fs = ''
0159  return

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/79953b70639baae785257738003d0b2f.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1