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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autmating 'groupwise' emails 3

Status
Not open for further replies.

hawkieboy

Programmer
Apr 30, 2002
49
GB
Hi

Our company has a client who uses 'groupwise' and i am having trouble finding info on how to automate through fox.

What I need to do:

I need to create 4 email's that attaches one file to each email.

Your help and guidance is appreciated in advance

Many Thanks

Nick
 
hawkieboy

Unfortunately I cannot test this code for you (I have no access to GroupWise):
Code:
private objGroupWise As Object, objAccount As Object, objMailbox As Object
private objMessage As Object, objMessages As Object, objRecipients As Object
private objRecipient As Object, MessageSent As Variant

objGroupWise = CreateObject("NovellGroupWareSession")
objAccount = objGroupWise.Login
objMailbox = objAccount.MailBox
objMessages = objMailbox.Messages
objMessage = objMessages.Add("GW.MESSAGE.MAIL", "Draft")
objRecipients = objMessage.Recipients
objRecipient = objRecipients.Add("myemail@address.com")
objMessage.Subject = "Here's your report."
objMessage.BodyText = "Here's the report you wanted."
objMessage.Send
=MessageBox ("Message Sent!")

And you can find the GroupWise object model here:

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike

Just got around to testing the code you supplied.

It worked first time "I'm Impressed"

Many Thanks

Nick
 
This may not answer your question but will give you some good background.

There are 3 ways to send mail from an application.
1. Automation
loGW = CreateObject("NovellGroupWareSession")

2. MAPI (Mail-API)
An example of this can be seen in the solutions.pjx. Go ahead and run through it. It has a show-code section. This example uses (I believe) microsofts mail control, but there are others 3rd party ones like MARBY:

3. SMTP (Simple mail transportation protocol)
Most feel you should try to use Option 3 first, then 2, and the then 1. However, it is probably case by case depending on your volume, attachments, etc.

I believe Rich Strahl has a SMTP class he wrote. It comes with his web-connect product, but can also be purchased for arond $100.00. Rick's site is

Jim Osieczonek
Delta Business Group, LLC
Lansing, MI
jimo@deltabg.com

[Independent company and always looking for work]
 
Jim

If you are simply sending emails SMTP and MAPI are OK but if you want to use GroupWise's tasks, document links etc you need to do it direct.

Regards


Regards

Michael Hawksworth
 
To expand on Mikes work a little for anyone interested.

This is with GW 6.5.

The line: objMessage = objMessages.Add("GW.MESSAGE.MAIL", "Draft") can be shortened to objMessage = objMessages.Add("GW.MESSAGE.MAIL") as the draft option is the default. However, if you use the draft option and dont point the message to the workfolder you must remember to delete the resulting draft message after you send it (objMessage.Delete)

If you want the email to be originated from another sender than the one logged on use the MultiLogin function. Note however that if the client is in cached mode you wont be able to get this to work unless you spcifiy the server ip address in the parameters (/ipa-111.111.111.111), this will make it connect your coded session on-line. Otherwise it will just keep asking for the cached client password and when you get it wrong a few times will lock the cached clients account.
e.g.
objAccount = objGroupWise.MultiLogin(_sUser,_sParameters,_sPassword)

To name a recipient as a CC or BC simply add the following:
objRecipient2 = objRecipients.Add("Michael") && CC
objRecipient2.TargetType = egwCC && or egwBC


Regards

Michael Hawksworth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top