Page 2 of 2

PostPosted: Fri Dec 05, 2008 12:46 am
by driessen
James,

My experience is telling me that the error.log file always is written into the default directory.

Thanks for your messages in this topic.

PostPosted: Fri Dec 05, 2008 5:47 pm
by hag
Driessen:

The functiion works great. But I have a question.

I have several hundred uers around the world. What are you doing if the user does not use Outlook email?

PostPosted: Fri Dec 05, 2008 5:52 pm
by James Bott
Harvey,

I suggest that you use the TMail class which uses whatever MAPI client email system the user has--it doesn't have to be Outlook.

Regards,
James

PostPosted: Fri Dec 05, 2008 7:09 pm
by hag
James:

Thanks for the quick response. Could you tak a look at Dreissens code on this thread a let me know how to modify it. Appreciated.

PostPosted: Fri Dec 05, 2008 7:34 pm
by hag
James
In samples there is a file called james.prg regarding emails. Is that yours and does it use the tmail class. I'm a novice at using classes.

PostPosted: Fri Dec 05, 2008 7:42 pm
by James Bott
MAPI Mail Syntax:

DEFINE MAIL [ <oMail> ];
[ SUBJECT <cSubject> ];
[ TEXT <cText> ];
[ TYPE <cType> ];
[ DATE <dDate> ];
[ TIME <cTime> ];
[ CONVERSATION <cConversation> ]:
[ RECEIPT ];
[ FROM USER ];
[ FILES <cFilename1> ,<cDescript1>, <cFilenameN>, <cDescriptN> ] ];
[ ORIGIN <cOrigin> [ <cOriginAddress> ] ];
[ TO <cTarget1>, [ <cTargetAddress1> ] [ <cTargetN> [ <cTargetAddressN> ] ] ];

FILES
When specifying an attachment file you must include the path and a description. Use a two dimensonal array, the first element is the filename with path, the second is the description. You can have multiple files by adding more elements.

aFiles:={"c:\my docments\mydoc.doc","mydoc.doc"}

If the attachment file is html (has a .htm or .html extension) and you do not specify any TEXT (a message) then the file will appear in the message area.

For Outlook do it this way:

oMail:HTMLBody = ...

ERRORS
If you specify a TO and the parameter is blank and you are using the FROM USER clause, the message compose box will not appear. Likewise if the filename is invalid or not found. It is best to use an error trap:

Code: Select all  Expand view
   DEFINE MAIL...
   ACTIVATE MAIL...

   IF oMail:nRetCode!=0
      MsgAlert("The message could not be sent due to an error."+CRLF+;
      "MAPI error code: "+ltrim(str(oMail:nRetCode)),"Alert")
   ENDIF

PostPosted: Fri Dec 05, 2008 7:46 pm
by hag
Thanks for the help I'll give it a try later today.

PostPosted: Sat Dec 06, 2008 4:34 pm
by hag
James
The tmail class worked perfectlt.
Thanks for the help.