emailing function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bobh

    emailing function

    Hi All,
    I have this function which sends an email and it works great as is
    but, the one thing that I would like to change is it creates the email
    in the 'work in progress' folder in Groupwise and after sending the
    email it does not delete it from the 'work in progress' folder.
    Hopefully someone can tell me or add to this the vba code needed to
    have this delete the created email from the 'work in progress' folder
    once it sends it.
    thanks
    bobh.

    Public Function SendGWMail(Disp layMsg As Boolean, _
    strTo As String, strCC As String, strBCC As String, _
    strSubject As String, strBody As String, strAttachPathFi le As String)
    As Boolean

    ' This will log you in to Groupwise if you are not logged in already
    except if you have your
    ' Groupwise account password protected then you must log-in to
    Groupwise first.
    Const NGW$ = "NGW"
    Dim GWCom As Object
    Dim RetStr As String, MessageId As String

    SendGWMail = False

    ' Create the Groupwise session
    'Dim gwappl As GroupwareTypeLi brary.Applicati on2
    'Dim gwacc As GroupwareTypeLi brary.Account2
    'Dim gwnewmessage As GroupwareTypeLi brary.Message

    Dim gwappl As Object, gwacc As Object, gwnewmessage As Object

    Set gwappl = CreateObject("N ovellGroupWareS ession")
    Set gwacc = gwappl.Login
    Set gwnewmessage = gwacc.WorkFolde r.Messages.Add( "GW.Message.mai l")

    ' Create the message
    With gwnewmessage
    With .Recipients
    ' Add the To recipient(s) to the message
    If (strTo <"") Then
    '.Add strTo
    .Add strTo, NGW
    End If
    ' Add the CC recipient(s) to the message
    If (strCC <"") Then
    .Add strCC, NGW
    End If
    ' Add the BCC recipient(s) to the message
    If (strBCC <"") Then
    .Add strBCC, NGW
    End If
    End With

    ' Set the Subject, Body, and Importance of the message
    .Subject = strSubject
    .BodyText = strBody
    .Priority = 3

    ' Add attachments to the message.
    If (strAttachPathF ile <"") Then
    .Attachments.Ad d strAttachPathFi le
    End If

    ' Should we display the message before sending?
    If DisplayMsg Then
    ' Display message to user
    MessageId = .MessageId
    Set GWCom = CreateObject("G roupwiseCommand er")
    GWCom.Execute "ItemOpen (""" & MessageId & """)", RetStr
    GWCom.Execute "ItemSetTex t (""X00"";To! ; """ & strTo & """;
    0)", RetStr
    Else
    .Send
    End If
    End With

    SendGWMail = True
    Set gwnewmessage = Nothing

  • bobh

    #2
    Re: emailing function

    Hi All,
    I know that not all things are answered here but I am curious about
    this one, does the no replies mean no one knows?
    bobh.

    On Oct 10, 3:47 pm, bobh <vulca...@yahoo .comwrote:
    Hi All,
    I have this function which sends an email and it works great as is
    but, the one thing that I would like to change is it creates the email
    in the 'work in progress' folder in Groupwise and after sending the
    email it does not delete it from the 'work in progress' folder.
    Hopefully someone can tell me or add to this the vba code needed to
    have this delete the created email from the 'work in progress' folder
    once it sends it.
    thanksbobh.
    >
    Public Function SendGWMail(Disp layMsg As Boolean, _
    strTo As String, strCC As String, strBCC As String, _
    strSubject As String, strBody As String, strAttachPathFi le As String)
    As Boolean
    >
    ' This will log you in to Groupwise if you are not logged in already
    except if you have your
    ' Groupwise account password protected then you must log-in to
    Groupwise first.
    Const NGW$ = "NGW"
    Dim GWCom As Object
    Dim RetStr As String, MessageId As String
    >
    SendGWMail = False
    >
    ' Create the Groupwise session
    'Dim gwappl As GroupwareTypeLi brary.Applicati on2
    'Dim gwacc As GroupwareTypeLi brary.Account2
    'Dim gwnewmessage As GroupwareTypeLi brary.Message
    >
    Dim gwappl As Object, gwacc As Object, gwnewmessage As Object
    >
    Set gwappl = CreateObject("N ovellGroupWareS ession")
    Set gwacc = gwappl.Login
    Set gwnewmessage = gwacc.WorkFolde r.Messages.Add( "GW.Message.mai l")
    >
    ' Create the message
    With gwnewmessage
    With .Recipients
    ' Add the To recipient(s) to the message
    If (strTo <"") Then
    '.Add strTo
    .Add strTo, NGW
    End If
    ' Add the CC recipient(s) to the message
    If (strCC <"") Then
    .Add strCC, NGW
    End If
    ' Add the BCC recipient(s) to the message
    If (strBCC <"") Then
    .Add strBCC, NGW
    End If
    End With
    >
    ' Set the Subject, Body, and Importance of the message
    .Subject = strSubject
    .BodyText = strBody
    .Priority = 3
    >
    ' Add attachments to the message.
    If (strAttachPathF ile <"") Then
    .Attachments.Ad d strAttachPathFi le
    End If
    >
    ' Should we display the message before sending?
    If DisplayMsg Then
    ' Display message to user
    MessageId = .MessageId
    Set GWCom = CreateObject("G roupwiseCommand er")
    GWCom.Execute "ItemOpen (""" & MessageId & """)", RetStr
    GWCom.Execute "ItemSetTex t (""X00"";To! ; """ & strTo & """;
    0)", RetStr
    Else
    .Send
    End If
    End With
    >
    SendGWMail = True
    Set gwnewmessage = Nothing

    Comment

    Working...