Retrieve email signature from Lotus Notes

I've got a Type mismatch error as per attachment

Dim strProfileEnableSignature

Set oSession   = CreateObject("Notes.NotesSession")
strServer      = oSession.GetEnvironmentString("MailServer",True)
strUserName    = oSession.UserName
strMailDbName  = Left(strUserName, 1) & Right(strUserName, (Len(strUserName) - InStr(1, strUserName, "")))&".nsf"

set MailDb = oSession.CurrentDatabase

Set docProfile = Maildb. GetProfileDocument ("CalendarProfile")

strProfileEnableSignature = docProfile.GetItemValue("EnableSignature")(0)

If strProfileEnableSignature = "1" Then

   docProfile. EnableSignature = "" 

   Select Case docProfile. GetItemValue ("SignatureOption") (0)
   Case "1"
      strSing = docProfile. GetItemValue ("Signature_1") (0)
   Case "2"
      strSing = docProfile. GetItemValue ("Signature_2") (0)
   Case "3"
      strSing = docProfile. GetItemValue ("Signature_Rich") (0)
Case Else

End Select

Call docProfile. Save (True, False)

End If

maildoc. Body = BodyText AND vbCrLf AND strSing
Set uidoc = uiWorkspace. EditDocument (True, maildoc)
If strProfileEnableSignature = "1" Then
docProfile. EnableSignature = "1"
Call docProfile. Save (True, False)
End If
error.bmp
Bianchi928Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
I don't see any obvious mistakes here...

What I did see:
- is there a CurrentDatabase ? I know of the property, but I can hardly imagine a VN session with a current database right from the start
- is line 12 in the image also line 12 above ?
- any reason why you use a Notes.NotesSession and not a Lotus.NotesSession object? Ok, I see, EditDocument...
- please don't attach .bmp files, where a .gif or .jpg would be 90% smaller... ;-)
0
RobSampsonCommented:
Hi, instead of
strProfileEnableSignature = docProfile.GetItemValue("EnableSignature")(0)

you can try
strProfileEnableSignature = docProfile.EnableSignature

Regards,

Rob.
0
Bianchi928Author Commented:
Hi Rob !! How have u bern ?

I did the chnage and I have a "Type mismatch on
If strProfileEnableSignature = "1" Then

Okay..Let me put you in the picture of what I want to do. The little script down below sends email from  an Excel sheet list of people. All I want to do is to add my signature which is an HTML one  at the bottom of each email being sent. The choice of HTML is because I have 2 hyperlinks in there for the recipient to use if needed.


All I want to do is to make the following   www.beaurepaires.com.au & com_crm@beaurepaires.com.au clickable (hyperlinks). I din't have any exposure to have this same script done in HTML.  So, I have built up an HTML signature and I wanted to use it.  Hopefully it all make sense here.

I have attched a pic of the htnl.
Thanks
Cheers

   'option explicit
 
    Dim oSession        ' AS NotesSession
    Dim strServer
    Dim strUserName
    Dim strMailDbName
    Dim oCurrentMailDb  ' as NOTESDATABASE
    Dim oMailDoc        ' as NOTESDOCUMENT
    Dim ortItem         ' as NOTESRICHTEXTITEM
    Dim ortAttacment    ' as NOTESRICHTEXTITEM
    Dim oEmbedObject    ' as ????
    Dim cstrAttachment
    Dim emailaddress
    Dim filename
    Dim blAttachment
    Dim objFSO
    Dim wmiQuery, objWMIService, objPing, objStatus

    Set objShell = CreateObject("WScript.Shell")

'########### Variables that can be changed ##############

    strExcelFile = "d:\stevenbu\COM Retail Customer direct email"
    cstrAttachment  = "d:\stevenbu\Drive In Flyer.pdf"
    subject = "Beaurepaires Truck Tyre Specials November 2013"

'########################################################

    Const xlUp = -4162
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = False
    Set objWB = objExcel.Workbooks.Open(strExcelFile, False, False)
    Set objSheet = objWB.Sheets(1)

    Set objFSO = CreateObject("Scripting.FileSystemObject")

  For intRow = 3 To objSheet.Cells(65536, 1).End(xlUp).Row
 
    emailmessage = ""

    customername  = objSheet.Cells(intRow, "M").Value  
    customeremail = objSheet.Cells(intRow, "AQ").Value
    Customerpplan = objSheet.Cells(intRow, "AZ").Value

    blAttachment = true
 
    Set oSession = CreateObject("Notes.NotesSession")
 
    strServer = oSession.GetEnvironmentString("MailServer",True)
   
    strUserName = oSession.UserName
 
    strMailDbName = Left(strUserName, 1) & Right(strUserName, (Len(strUserName) - InStr(1, strUserName, "")))&".nsf"
 
    set oCurrentMailDb = oSession.CurrentDatabase

'    signature = oCurrentMailDb.GETPROFILEDOCUMENT("CalendarProfile").GETITEMVALUE("Signature")(0)
 
    If oCurrentMailDb.IsOpen = True Then
        ' Already open for mail
    Else
        oCurrentMailDb.OPENMAIL
    End If
    Set oMailDoc = oCurrentMailDb.CREATEDOCUMENT
 
    OMailDoc.form = "Memo"  
   

'########### Variables that can be changed ##############

    emailmessage = emailmessage & "Dear " & customername & vbcrlf & vbcrlf
    emailmessage = emailmessage & "Thanks for choosing Beaurepaires to service you. " & vbcrlf
    emailmessage = emailmessage & "As our valued customer, we would like to give you a special offer of 5% off your current price plan " & customerpplan & " on our two new products" & vbcrlf
    emailmessage = emailmessage & "11R22.5 FuelMax LHD II (567581)" & vbcrlf
    emailmessage = emailmessage & "11R22.5 R425 (565012)" & vbcrlf
    emailmessage = emailmessage & "Valid as from Nov 1, 2013 till Nov 30, 2013" & vbcrlf & vbcrlf
    emailmessage = emailmessage & "For more details, please refer to the attachment or visit www.beaurepaires.com.au" & vbcrlf
    emailmessage = emailmessage & "Find your nearest stores" & vbcrlf
    emailmessage = emailmessage & "Get online Quotation" & vbcrlf
    emailmessage = emailmessage & "View our online catalogue" & vbcrlf & vbcrlf
    emailmessage = emailmessage & "Unsubscribe : com_crm@beaurepaires.com.au" & vbcrlf
'    emailmessage = emailmessage & signature
    emailmessage = emailmessage & "" & vbcrlf
    emailmessage = emailmessage & "" & vbcrlf

   
'########################################################
   
    with oMailDoc
'        .Principal = "CN=GDT IT Support/OU=GDT IT Support/O=GDYR"
        .Principal = "CN=GDT MAIL AUST COMMERCIAL BFT/OU=GDT MAIL AUST COMMERCIAL BFT/O=GDYR"
        .SendTo  = ucase(customeremail)
        .Subject = " " & subject
        .Body    = emailmessage
    end with


    If blAttachment Then
        Set ortAttacment = oMailDoc.CREATERICHTEXTITEM("Attachment")
        Set oEmbedObject = ortAttacment.EMBEDOBJECT(1454, "", cstrAttachment, "Attachment")
    End If
   

    with oMailDoc
        .PostedDate = Now()
        .SAVEMESSAGEONSEND = "False"

        .send(False)
    end with
   
next

  ' close objects
    set oMailDoc       = nothing
    set oCurrentMailDb = nothing
    set oSession       = nothing
    objExcel.Quit
    Wscript.echo " Job Done"
shot.GIF
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Sjef BosmanGroupware ConsultantCommented:
Several additional remarks:
- is line 12 in the image also line 12 above ?
- or which line does the code stop at?
- move the line creating the session object out of the loop
- this is not the way to create a mail with embedded HTML in Notes, you then have to use MIME objects
0
Bianchi928Author Commented:
I have already done all these changes. I must have posted an old version of the script. I don't have a clue how to use MIME objects to create a mail with embedded HTML.
0
Sjef BosmanGroupware ConsultantCommented:
So you no longer have the problem? Good!

To start with MIME mails, read this page, there are some good examples on it and some links: http://www.experts-exchange.com/Q_25395944.html
0
RobSampsonCommented:
>> Hi Rob !! How have u bern ?

I've been good thanks ;-)   Very busy at work.....

So with your current code (which I don't you have posted), are you getting any errors, and does it embed the attachment, or add any attachment at all?

Rob.
0
Bianchi928Author Commented:
Rob,

I'm nearly there.

I've been able to put this little script together and it does exactly what I want..ie..Have a hyperlink signature at the bottom.  But I encountered one problem on this line

CreateObject("Notes.NotesUIWorkspace").EDITDOCUMENT True, nMail

I've attached the error message & input file. All suggestions to make it work better are welcomed.

Sub SendLocalExtensionEmail()
Dim nMailBody As String
Dim nMailSubject As String
Dim nMailRecipient As Variant
Dim nMail As Object
Dim nSession As Object
Dim nDatabase As Object
Dim nMime As Object
Dim nMailStream As Object
Dim nChild As Object
Dim nSomeMailBodyText As String
Dim amountOfRecipients As Integer
Dim x As Integer

nMailRecipient = ""
nMailSubject = "Beaurepaires Truck Tyre Specials November 2013"

Set nSession = CreateObject("Notes.NotesSession")
Set nDatabase = nSession.GetDatabase("", "")
Call nDatabase.OPENMAIL
Set nMail = nDatabase.CreateDocument

'Example on how to get email adresses from a spreadsheet
With ThisWorkbook.Sheets("Sheet1")
amountOfRecipients = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For x = 1 To amountOfRecipients

  nMailRecipient = ThisWorkbook.Sheets("Sheet1").Range("B" & x & ":B" & x).Value
  nMail.SendTo = nMailRecipient
  nMail.Subject = nMailSubject
  customername = ThisWorkbook.Sheets("Sheet1").Range("A" & x & ":A" & x).Value
  customerpplan = ThisWorkbook.Sheets("Sheet1").Range("C" & x & ":C" & x).Value

  nSomeMailBodyText = " "
  nSomeMailBodyText = nSomeMailBodyText & "Dear " & customername
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "Thanks for choosing Beaurepaires to service you. "
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "As our valued customer, we would like to give you a special offer of 5% off your current price plan " & customerpplan & " on our two new products"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "11R22.5 FuelMax LHD II (567581)"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "11R22.5 R425 (565012)"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "Valid as from Nov 1, 2013 till Nov 30, 2013"

nSession.ConvertMIME = False
Set nMime = nMail.CreateMIMEEntity
Set nMailStream = nSession.CreateStream

'vBody contient le texte au format Html
Call nMailStream.WriteText(nSomeMailBodyText)
Call nMailStream.WriteText("<br>")
Call nMailStream.WriteText("<br>")

'----- READ AND PASTE SIGNATURE -------------------------------------
'Get the standard signature location
'nSignatureLocation = nDatabase.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)
nSignatureLocation = "d:\stevenbu\signature.htm" 'In case you would like to specify a path to an html file instead
'Required Reference: Windows Script Host Object Model
Dim fso As New FileSystemObject
Dim ts As TextStream
Set ts = fso.OpenTextFile(nSignatureLocation, ForReading)
Dim ThisLine As String
Dim i As Integer
i = 0
Do Until ts.AtEndOfStream
ThisLine = ts.ReadLine
'i = i + 1
'MsgBox ThisLine
Call nMailStream.WriteText(ThisLine)
Loop
ts.Close
'-------------------------------------------------------------------

Set nChild = nMime.CreateChildEntity
Call nChild.SetContentFromText(nMailStream, "text/html;charset=iso-8859-1", ENC_NONE)
Call nMailStream.Close
nSession.ConvertMIME = True
Call nMail.Save(True, True)
'Make mail editable by user
CreateObject("Notes.NotesUIWorkspace").EDITDOCUMENT True, nMail
'Could send it here

Next x

End Sub
error.GIF
0
Bianchi928Author Commented:
Forgot this one
emailrecipients.xls
0
Bianchi928Author Commented:
I forgot to ask 2 things

a) How do I attach a pdf file (same file for everyone)
b) what's the code to send the mail

Thanks
Cheers
0
RobSampsonCommented:
Hi, can't test this right now, but I found code to add an attachment, and also send (commented out), so hopefully it works.

Sub SendLocalExtensionEmail()
Dim nMailBody As String
Dim nMailSubject As String
Dim nMailRecipient As Variant
Dim nMail As Object
Dim nSession As Object
Dim nDatabase As Object
Dim nMime As Object
Dim nMailStream As Object
Dim nChild As Object
Dim nSomeMailBodyText As String
Dim amountOfRecipients As Integer
Dim x As Integer

nMailRecipient = ""
nMailSubject = "Beaurepaires Truck Tyre Specials November 2013"

Set nSession = CreateObject("Notes.NotesSession")
Set nDatabase = nSession.GetDatabase("", "")
Call nDatabase.OPENMAIL
Set nMail = nDatabase.CreateDocument

'Example on how to get email adresses from a spreadsheet
With ThisWorkbook.Sheets("Sheet1")
amountOfRecipients = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For x = 1 To amountOfRecipients

  nMailRecipient = ThisWorkbook.Sheets("Sheet1").Range("B" & x & ":B" & x).Value
  nMail.SendTo = nMailRecipient
  nMail.Subject = nMailSubject
  customername = ThisWorkbook.Sheets("Sheet1").Range("A" & x & ":A" & x).Value
  customerpplan = ThisWorkbook.Sheets("Sheet1").Range("C" & x & ":C" & x).Value

  nSomeMailBodyText = " "
  nSomeMailBodyText = nSomeMailBodyText & "Dear " & customername
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "Thanks for choosing Beaurepaires to service you. "
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "As our valued customer, we would like to give you a special offer of 5% off your current price plan " & customerpplan & " on our two new products"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "11R22.5 FuelMax LHD II (567581)"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "11R22.5 R425 (565012)"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "Valid as from Nov 1, 2013 till Nov 30, 2013"

nSession.ConvertMIME = False
Set nMime = nMail.CreateMIMEEntity
Set nMailStream = nSession.CreateStream

'vBody contient le texte au format Html
Call nMailStream.WriteText(nSomeMailBodyText)
Call nMailStream.WriteText("<br>")
Call nMailStream.WriteText("<br>")

'----- READ AND PASTE SIGNATURE -------------------------------------
'Get the standard signature location
'nSignatureLocation = nDatabase.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)
nSignatureLocation = "d:\stevenbu\signature.htm" 'In case you would like to specify a path to an html file instead

'Required Reference: Windows Script Host Object Model
Dim fso As New FileSystemObject
Dim ts As TextStream
Set ts = fso.OpenTextFile(nSignatureLocation, ForReading)
Dim ThisLine As String
Dim i As Integer
i = 0
Do Until ts.AtEndOfStream
ThisLine = ts.ReadLine
'i = i + 1
'MsgBox ThisLine
Call nMailStream.WriteText(ThisLine)
Loop
ts.Close
'-------------------------------------------------------------------

        'Set nChild = nMime.CreateChildEntity
        'Call nChild.SetContentFromText(nMailStream, "text/html;charset=iso-8859-1", ENC_NONE)
sAttachment = "C:\Temp\Test.txt"
Set nAttachment = nMail.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
Set oEmbedObject = nAttachment.EMBEDOBJECT(1454, "", sAttachment, "Attachment")

Call nMailStream.Close

nSession.ConvertMIME = True
Call nMail.Save(True, True)
'Make mail editable by user
CreateObject("Notes.NotesUIWorkspace").EDITDOCUMENT True, nMail
'Could send it here
'Call nMail.Send(False)

Next x

End Sub

Open in new window


One thing though, if you use the EDITDOCUMENT and the SEND, it will send before you get the chance to edit it.....

Regards,

Rob.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
Here's better code to attach a file to a MIME mail: http://searchdomino.techtarget.com/answer/Attach-file-in-LotusScript-to-MIME-mail.

To find out why it shows the error message, it might help if you separate the EditDocument call in 3 lines:

Dim ws As Object
Set ws= CreateObject("Notes.NotesUIWorkspace")
ws.EDITDOCUMENT True, nMail
0
Bianchi928Author Commented:
Thanks. I will check /test all of that tomorrow.

Cheers
0
Bianchi928Author Commented:
Hi Rob,

Did the test this morning. Just a couple of little issues. It sends the first email and then comes with this error  message

RunTime Error :  '7485'
Item Body Already exists

That's the lastest script and it's complaining about this line

Set nMime = nMail.CreateMIMEEntity

It send the first email and then comes with this error message.

Next , how can I get the signature to come after the body in the email

Thanks
Cheers

Sub SendLocalExtensionEmail()
Dim nMailBody As String
Dim nMailSubject As String
Dim nMailRecipient As Variant
Dim nMail As Object
Dim nSession As Object
Dim nDatabase As Object
Dim nMime As Object
Dim nMailStream As Object
Dim nChild As Object
Dim nSomeMailBodyText As String
Dim amountOfRecipients As Integer
Dim x As Integer

nMailRecipient = ""
nMailSubject = "Beaurepaires Truck Tyre Specials November 2013"

Set nSession = CreateObject("Notes.NotesSession")
Set nDatabase = nSession.GetDatabase("", "")
Call nDatabase.OPENMAIL
Set nMail = nDatabase.CreateDocument

'Example on how to get email adresses from a spreadsheet
With ThisWorkbook.Sheets("Sheet1")
amountOfRecipients = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For x = 1 To amountOfRecipients

  nMailRecipient = ThisWorkbook.Sheets("Sheet1").Range("B" & x & ":B" & x).Value
  nMail.SendTo = nMailRecipient
  nMail.Subject = nMailSubject
  customername = ThisWorkbook.Sheets("Sheet1").Range("A" & x & ":A" & x).Value
  customerpplan = ThisWorkbook.Sheets("Sheet1").Range("C" & x & ":C" & x).Value

  nSomeMailBodyText = " "
  nSomeMailBodyText = nSomeMailBodyText & "Dear " & customername
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "Thanks for choosing Beaurepaires to service you. "
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "As our valued customer, we would like to give you a special offer of 5% off your current price plan " & customerpplan & " on our two new products"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "11R22.5 FuelMax LHD II (567581)"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "11R22.5 R425 (565012)"
  nSomeMailBodyText = nSomeMailBodyText & "<BR>"
  nSomeMailBodyText = nSomeMailBodyText & "Valid as from Nov 1, 2013 till Nov 30, 2013"

nSession.ConvertMIME = False
Set nMime = nMail.CreateMIMEEntity
Set nMailStream = nSession.CreateStream

'vBody contient le texte au format Html
Call nMailStream.WriteText(nSomeMailBodyText)
Call nMailStream.WriteText("<br>")
Call nMailStream.WriteText("<br>")

'----- READ AND PASTE SIGNATURE -------------------------------------
'Get the standard signature location
'nSignatureLocation = nDatabase.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)
nSignatureLocation = "d:\stevenbu\signature.htm" 'In case you would like to specify a path to an html file instead

'Required Reference: Windows Script Host Object Model
Dim fso As New FileSystemObject
Dim ts As TextStream
Set ts = fso.OpenTextFile(nSignatureLocation, ForReading)
Dim ThisLine As String
Dim i As Integer
i = 0
Do Until ts.AtEndOfStream
ThisLine = ts.ReadLine
'i = i + 1
'MsgBox ThisLine
Call nMailStream.WriteText(ThisLine)
Loop
ts.Close
'-------------------------------------------------------------------

Set nChild = nMime.CreateChildEntity
Call nChild.SetContentFromText(nMailStream, "text/html;charset=iso-8859-1", ENC_NONE)
sAttachment = "d:\stevenbu\Drive In Flyer.pdf"
Set nAttachment = nMail.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
Set oEmbedObject = nAttachment.EMBEDOBJECT(1454, "", sAttachment, "Attachment")

Call nMailStream.Close

nSession.ConvertMIME = True
Call nMail.Save(True, True)
'Make mail editable by user
'CreateObject("Notes.NotesUIWorkspace").EDITDOCUMENT True, nMail
'Could send it here
Call nMail.Send(False)

Next x

End Sub
0
Sjef BosmanGroupware ConsultantCommented:
Did you read the page I posted a link to? In MIME mails there is no such thing as CreateRichTextItem, nor  is there EmbedObject. They handle RichText items and MIME isn't RichText.
0
Bianchi928Author Commented:
HI sjef_bosnan,

I've started to read and make sense out of it. In teh meantime I need to solve with problem that it fails after sendign the first email with

RunTime Error :  '7485'
Item Body Already exists

That's the lastest script and it's complaining about this line

Set nMime = nMail.CreateMIMEEntity


Thanks
Cheers
0
Sjef BosmanGroupware ConsultantCommented:
Well, you can't put fields(NotesItems) in the NotesDocument either, you must only use the MIMEEntity methods.

It's these two lines:
  nMail.SendTo = nMailRecipient
  nMail.Subject = nMailSubject

Check how the other code sets the mail subject...
0
RobSampsonCommented:
I haven't looked through the other code yet, but what I suggest in your code is above this line:
Set nMail = nDatabase.CreateDocument

put this:
Set nMail = Nothing
Set nMime = Nothing

and see how that goes.

Rob.
0
Bianchi928Author Commented:
Hi Rob,

I have put these 2 lines above    Set nMail = nDatabase.CreateDocument
and I got teh same Error Message
0
RobSampsonCommented:
Oh, those lines aren't in the For loop.

Can you move these lines:
Set nMail = Nothing
Set nMime = Nothing
Set nMail = nDatabase.CreateDocument

Open in new window


down underneath this line:
For x = 1 To amountOfRecipients

Open in new window


so that it recreates nMail for each new message.

Regards,

Rob.
0
Sjef BosmanGroupware ConsultantCommented:
Indeed, if you use MIME you have to create a fresh document each time. But the first mail should have been sent. Is that the case?
0
Bianchi928Author Commented:
Rob,

Thanks. It work now. The emails are sent
Any idea as to why it saves the sent emails in drafts ?

Cheers
0
RobSampsonCommented:
I would say it's got something to do with this line:
Call nMail.Save(True, True)


Try
Call nMail.Save(False, False)

http://www-12.lotus.com/ldd/doc/lotusscript/lotusscript.nsf/1efb1287fc7c27388525642e0074f2b6/7f9e4a452fa9cb978525642e0076d249?OpenDocument

Regards,

Rob,
0
Bianchi928Author Commented:
Don't worry about my last question. I fixed the issue. Thanks to you both for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.