View Full Version : QtmmSendMail API - How to send 1 file to multiple receipients
08-27-2002, 10:12 AM
Derek, it is not clearly written but there is a repeating structure that is used by the QTMMSENDMAIL API that allows you to send to multiple recipients. The link below has the info... http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm The ADDTO100 structure repeats (if you want it to!). The first field is used to set the offset to the next structure. Let me know if this helps. Jeff
08-27-2002, 10:48 AM
Jeff, Thanks for the reply. Let me see if I understand this. Are you saying that the recipient goes first, then you use the offset and set the next recipient and so on? What my program currently does is load the first recipient. Then it calls the API. Do I just loop and read all recipients? Let me know if I need to send you the code I have just so I can make sure I understand. Thanks again. derek
08-27-2002, 11:37 AM
The way that I understand it is as follows: The parameter for the "first recipient address" (which is actually going to be "ALL recipients") is formatted as shown in the table ADDT0100 (refer to the web site again). Therefore the field you use for this parameter should either be very large or variable length. As an example if you were sending to just two recipients email@example.com and firstname.lastname@example.org the structure would look something like this: binary(4) "offset" = 40 (length to beginning of next entry) binary(4) "address length" = 16 Char(8) "format type" = ADDT0100 binary(4) "distribution type" = 0 = to, 1 = cc, 2 = bcc binary(4) "reserved" = 0 char(variable) "SMTP address" = email@example.com The "offset" is 40 because you've got 24 bytes/char in the fields prior to the SMTP address and the SMTP address itself is 16 chars. To continue... binary(4) "offset" = 41 (even though this is the last entry) binary(4) "address length" = 17 Char(8) "format type" = ADDT0100 binary(4) "distribution type" = 0 = to, 1 = cc, 2 = bcc binary(4) "reserved" = 0 char(variable) "SMTP address" = firstname.lastname@example.org The actual field that you pass will be a single field with all the above information strung together. The simple way to do this would probably be... 1. Create a data structure similar (or identical!) to the ADDT0100 table. 2. Fill in the fields with the information for a single recipient. 3. Concatenate the entire data structure to a large alphanumeric field. 4. Repeat steps 1 - 3 for all the recipients. 5. Call the API Remember to change the "total number of recipients" field to reflect the correct number. HTH, Jeff
08-28-2002, 05:24 AM
I actually think I understand! I do have 1 more question if I may. How did you get 24 bytes in front? The book shows File name - Input (Char(*)) Len - Input (binrary(4)) Then you start the addresses. Please explain. THANKS SO MUCH Have a wonderful day!
08-28-2002, 06:08 AM
Unless the book is wrong, it should show... 1. file name (input char(*)) 2. length of file name (input binary(4)) 3. Originator address (input char(*)) - this is the "from" address 4. length of originator address (input binary(4)) 5. first recipient address (input ADD0100(*)) - this is all of your recipients. 6. Total number of recipients input(binary(4)) 7. error code (i/o char(*)) The "first recipient address" is entered in the format shown by the table ADD0100. Therefore, the 40 char offset is calculated ONLY on the ADD0100 table/structure. So... 4 - offset to next address (input binary(4)) + 4 - length of address (input binary(4)) + 8 - address format type (input char(8)) = "ADDT0100" + 4 - distribution type (input binary(4)) + 4 - reserved (input binary(4)) = 24 Then to complete the offset you need to add in the actual length of the SMTP destination address (in our example email@example.com). In this case the length is 16. So 16 + 24 = 40 In may easier to think of the recipient address as a multiple occurence data structure with the layout shown in ADD0100. HTH, Jeff
08-28-2002, 06:45 AM
To whom it may concern: This is very new to me but after about 1 week of research and development, I have finally written a program using different examples and techniques. My problem comes when I have 1 MIME email needing to go to 3 people. According to the program examples I have seen, it looks like 1 receipient is sent. How do you send multiple receipients? Please email me firstname.lastname@example.org. Thanks in advance for your help.
08-28-2002, 06:45 AM
Thank you very much. Now, I understand. I was having a problem trying to figure out how the 24 was there. So, I thank you from the bottom of my heart. Thanks for helping me through this problem. DL
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.