Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you send an e-mail to Groupwise from access 1

Status
Not open for further replies.

DPrent

MIS
May 21, 2004
7
GB
Hi Could someone help, I am trying to send an e-mail (using Groupwise) from an Microsoft Access a form.
Thanks

Dave
 
is group wise like outlook or like hotmail web based


Brought to you By Nedaineum
The Portal to Geek-tum
 
I must admit I'm not sure, but I think it's like Outlook
Kind Regards

Dave
 
Hi
I used an API Gateway(available with Groupwise).

You create an Email Header file :

WPC-API=1.2;
Header-Char=T50;
Msg-Type=Mail;
From-Text=Senders Name;
To=Recipient1's Address,Recipient2's Address;
Msg-File=EMAILBODY.TXT;
ATTACH-FILE=
Original-File=IntFileL.SNP;
;
To-Text=Names of Recipients;
Subject=Subject of E-mail;
-END-

Call this file EMAILHEAD.TXT

The "From-Text" is for instance your name.
The "To" is a list of the recipients E-mail addresses
The "Msg-File" is the body of your E-mail
The "ATTACH-FILE/Original-File" is an attachment - in this case a snapshot file.
The "To-Text" is the Name(s) of your recipients in plain text
The "Subject" is the subject of the e-mail.

Place this in a folder called say EMAILFOLDER
Make sure Intfile.snp (or whatever you call any attachments)
is in EMAILFOLDER

Likewise for EMAILBODY.TXT

Create a .BAT file called say EMAIL.BAT in EMAILFOLDER to have the following contents:

COPY C:\EMAILFOLDER\IntFileL.SNP M:\AHT.DOM\WPGATE\APIOS2\ATT_IN
COPY C:\EMAILFOLDER\EMAILBODY.TXT M:\AHT.DOM\WPGATE\APIOS2\ATT_IN
COPY C:\EMAILFOLDER\EMAILHEAD.TXT M:\AHT.DOM\WPGATE\APIOS2\API_IN
CD\DOS
EXIT

On your form, place a button to run a macro.

The macro will perform the RunApps Action:

C:\EMAILFOLDER\EMAIL.BAT

I must admit that our IT dept had set up the directories referred to in the EMAIL.BAT file-I merely used them.It did work in a live office situation. The path names in EMAIL.BAT are particular to our setup but you might have your own.
Its some time since I used this but it might point you in the right direction.The is a Manual available for the API.
Cheers
G.
 
Hi,

I have been using this code for a long while now with very few problems:

Code:
Public Function SendMail(Recip As String, Optional Subject As Variant, Optional Message As Variant, Optional Attach As Variant)
Dim intChan As Variant
Dim GroupwiseID As Long
Dim strCommand, strParam As String
Dim boolGWOpen As Boolean
Dim strQuote As String
Dim retval As Long
'the following path needs to point to where Groupwise is installed
Const strGWApp = "G:\software\client\win32\GrpWise.exe"
On Error Resume Next
strQuote = Chr(34)
intChan = DDEInitiate("GroupWise", "Command") 'Attempt to establish conversation with GroupWise

If Err Then 'If an error occurs, GroupWise is not open
boolGWOpen = False 'Set the flag to false
Err = 0 'Reset error
GroupwiseID = Shell(strGWApp) 'Open GroupWise minimized without focus

If Err Then 'If another error occurs then exit
MsgBox "GroupWise could not be started", vbOKOnly + vbInformation, "Error loading GroupWise"
Exit Function
End If

On Error GoTo GroupWise_Not_Open
GroupWise_Try_Again:
intChan = DDEInitiate("GroupWise", "Command") 'Attempt to establish GroupWise link
Else
boolGWOpen = True 'GroupWise was open
End If
On Error GoTo Err_SendMail
'Build the parameter string
If IsMissing(Subject) And IsMissing(Message) And IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote
ElseIf IsMissing(Subject) And IsMissing(Message) Then
strParam = strQuote & Recip & strQuote & "; ; ; " & strQuote & Attach & strQuote
ElseIf IsMissing(Message) And IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote
ElseIf IsMissing(Subject) And IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote & "; ; " & strQuote & Message & strQuote
ElseIf IsMissing(Subject) Then
strParam = strQuote & Recip & strQuote & "; ; " & strQuote & Message & strQuote & "; " & strQuote & Attach & strQuote
ElseIf IsMissing(Message) Then
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote & "; ;" & strQuote & Attach & strQuote
ElseIf IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote & "; " & strQuote & Message & strQuote
Else
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote & "; " & strQuote & Message & strQuote & "; " & strQuote & Attach & strQuote
End If
'Build the Command string
strCommand = "SendMail(" & strParam & ")"

'Send the mail message
DDEExecute intChan, strCommand
'Close the GroupWise link
DDETerminate intChan
If Not boolGWOpen Then 'If GroupWise was not open
'AppActivate GroupwiseID, True 'Activate the Groupwise window
AppActivate "GroupWise - Mailbox", False
SendKeys "%{F4}", True 'Close GroupWise
End If

Exit_SendMail:
Exit Function
GroupWise_Not_Open:
Err = 0 'Reset error
Resume GroupWise_Try_Again 'Re-attempt to establish conversation with GroupWise

Err_SendMail:
MsgBox Err.Description
Resume Exit_SendMail

End Function

All you need to do is repoint to the location of your installation of GroupWise.

Hope this is of use :)
Sim

----------------------------------------
My doctor says that I have a malformed public duty gland and a natural deficiency in moral fibre and that I'm therefore excused from saving universes.
----------------------------------------
 
Thanks Mute101 for your expert help. I am new to programming in access and until now used only the basics, could help me one more time. Sorry for being thick, but I presume I was to place your code in the General Declarations (was this correct)then somehow call the sendemail command
many thanks again and kind regards

Dave
 
I have the code sat im a module called MailLib but the name isn't important(just dont call the module SendMail). Put it in a module and then you will be able to call the function in code like this:

Code:
SendMail("someone@somewhere.com","Title of Email","Email text","File attatchment path")

or

Code:
strTo = "someone@somewhere.com"
strTitle = "Hello Dave"
strMsg = "This should sort you out..."
strFile = "C:/Files/somefile.txt"
SendMail(strTo, strTitle, strMsg, strFile)

As you can see in the declaration only the 'To' filed is necessary to send an email the rest you can use as you need them.

----------------------------------------
My doctor says that I have a malformed public duty gland and a natural deficiency in moral fibre and that I'm therefore excused from saving universes.
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top