|
John, Here are some (rambling) thoughts: 1. The message file you create has to be a fully formed MIME message and has to be in ASCII. In the example code below the file will be in EBCDIC. If you want to write directly to the /test directory on the AS/400 you must first convert the output to ASCII. You can use the QDCXLATE API by including the qdcxlate.h header file and calling the API to convert to ASCII. An alternative method would be to write the data to an AS/400 flat file and then use the CPYTOSTMF command to put it in the /test directory and do the EBCDIC to ASCII conversion. You should be aware that the message should be in MIME format - that is it needs the To:, From:, Subject:, and other headers that a MIME message would need. This is true even though the QtmmSendMail API also requires some of this information. If you leave out the basic headers the recipient will not be able to reply to your message properly. You can get a list of the headers in the MIME RFCs. I think you can go to Yahoo and search on "RFC" to find places that store these documents. As an approach to developing the mail message I suggest creating the message in a flat file on the AS/400 and copying it to the /test directory using CPYTOSTMF, then call the QtmmSendMail API to process the file. When the file is working OK you will have a good basis for developing the C code that writes the message text. One word of caution - I think there is a problem with the IBM-supplied QASCII translation table with regard to the CR character. It has to end up as hex 0D in ASCII, but I think doesn't do this the way you would expect. You might need to use your own table. Let me know if you would like some source for an EBCDIC to ASCII translation table. I'm reaching back in my memory (which is unreliable at best), but I think I used EBCDIC hex 25 instead of 15. Lastly, you might like to get a good ASCII hex interpreter if you don't have one. I use Hxpert32 by Matthew Woolsey. It works on 95/NT. You can get it at www.shareware.com. Best value for $20 I ever got! Hope this helps! Patrick John Hall wrote: > > Patrick > > Sorry to be a pest. > > I have everything working ... but > > I am having trouble producing the file for the QttmSendMail API to > actually send. > > out = fopen("/test/email.txt","w, crlf=Y"); > fprintf(out, "\015\012\015\012"); - will place CRLFCRLF in file so > e-mail can be sent. > > fprintf(out,"Hello World\n"); - Will send garbage message to recipient. > > I am having trouble controlling ascii conversion or lack thereof. > > HELP !!!! > > John Hall > +--- > | This is the Midrange System Mailing List! > | To submit a new message, send your mail to MIDRANGE-L@midrange.com. > | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. > | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- -- Patrick Townsend mailto:townsend@patownsend.com Patrick Townsend & Associates, Inc. http://www.patownsend.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.