SMTP users

50 pts.
Tags:
CL Program
Email
SMTP
SNDDST
Do all users need their own directory entry to send emails. Is there a way for anyone to signon to the system and use a CL program that sends an email message by SNDDST.

Answer Wiki

Thanks. We'll let you know when a new response is added.

<i>Do all users need their own directory entry to send emails.</i>

No. They only need a directory entry if they’re using SNADS functions. If the e-mail is going to be all SMTP, then there probably shouldn’t be any SNADS elements dragged into it.

<i>Is there a way for anyone to signon to the system and use a CL program that sends an email message by SNDDST.</i>

Yes. First, signon to the system with a valid profile and password. Then, call a CL program that includes SNDDST.

I mean, what other answer is possible?

A little beyond that, if you use SNDDST, then you’re dragging SNA functions into the situation. If all you want is SMTP e-mail, why would you want to use a SNA-based command? That’s the first element that causes the system directory entry to be needed. (Your question has “SMTP” in the title rather than “SNA”.)

Note that you <i>might</i> be able to get by with a single directory entry if you have a generic user ID and reply address that everyone may use. The SNDDST can be executed after switching to the generic user as the current-user and switching back after SNDDST runs.

Tom

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Koohiisan
    I modified my snddst frontend CL to add them to the system directory if it errored out. But, I'd love to find a better way too!
    5,020 pointsBadges:
    report
  • Stark99
    Thanks Tom. Can I send an email without using SNDDST? "The SNDDST can be executed after switching to the generic user as the current-user and switching back after SNDDST runs." How can you switch users?
    50 pointsBadges:
    report
  • Teandy
    Yes. There are several email software packages for the iSeries. MMAIL (which I used for years!) and RPGMAIL are two that come to mind and both are free. There are also several commercial packages available. The one we use now is MailTool and MailTool Plus from Brad Stone.
    5,860 pointsBadges:
    report
  • TomLiotta
    Can I send an email without using SNDDST? Sure. Just open a socket to a SMTP server and write the e-mail lines to the socket. SMTP itself is a very simple sockets protocol. The real trick is with the requirement that every byte of every SMTP e-mail must consist only of "ASCII printable" characters. (There are some SMTP servers that can handle that for you, but they must do it themselves whenever e-mails must be routed to external e-mail servers.) The way nearly all SMTP clients handle the "ASCII printable" requirement is by following MIME attachment standards. Sections of the e-mail that may be non-text are passed through a procedure that does some encoding, such as base64 encoding. MIME boundaries are establish at the beginning and end of that section of the e-mail to show where it starts and stops and what kind of object it is, what its name might be and other attributes. The result of base64 encoding is a block of bytes all of which are in the "ASCII printable" range. These are 64 ASCII characters generally consisting of A-Z, a-z, and 0-9, plus a couple others. Bits in all the bytes have been extracted and put back together in a way that allows them to be decoded back to their original form at the receiving end, while having no byte in the sequence that gets transmitted be outside of the set of allowed characters. The MIME boundaries are the delimiters. Base64 encoding is usually limited to attachments; it encodes to a subset of the 7-bit ASCII character set. The actual body of an e-mail still needs to consist of characters from the 7-bit ASCII set. It's just accepted that these characters will not include any that fall in the full 8-bit ASCII range. Characters outside the accepted range have historically been used as certain 'control' characters that could otherwise cause trouble in transmission. SNDDST doesn't do ASCII. It's an EBCDIC function. It also doesn't do SMTP. It's a SNA function. It was enhanced back in V3 to allow text to be relayed to the system's SMTP server. It doesn't do MIME encoding (nor deciding). Because SNDDST is EBCDIC based, if you need to send non-text anything, you need to ensure that whatever it is that will be sent is already in the proper format including the MIME boundary records. You also need to ensure that if any EBCDIC/ASCII conversions happen along the way, that they won't scramble the bytes that get sent. That means that you better have your system QCCSID value set to a proper CCSID and that your (stream)files have proper CCSID attributes that actually represent the data in the file and that your jobs run under appropriate CCSIDs. Of course, you can always do the same thing that's done on every other platform -- install an e-mail client that does the work for you. The noted MMAIL and RPGMAIL utilities are examples. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    How can you switch users? Three APIs are useful: the Get Profile Handle (QsyGetProfileHandle), Set Profile Handle (QWTSETP, QsySetToProfileHandle) and Release Profile Handle (QSYRLSPH, QsyReleaseProfileHandle) security-related APIs. In short, you:
    1. Get a handle for job user,
    2. Get a handle for the new user,
    3. Switch to the new current-user,
    4. (do the work, e.g., SNDDST),...
    5. Switch back to job-user,
    6. Release the two handles.
    That's the basics. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    I missed adding the Get Profile Handle (QSYGETPH) API. Tom
    125,585 pointsBadges:
    report
  • Stark99
    Thanks for all your help Tom. What I have decided to do is stay using SNDDST. This will be used in a batch CL program that will be submitted under a common userid. In this way all users can use the email program but only the common userid requires a directory entry. Seems to work fine. Thanks again, Alan
    50 pointsBadges:
    report
  • Koohiisan
    Stark99, Did you have to compile it using the owner's authority? I tried to do the same system myself as that which you described, but my batch program (from a file trigger) always submitted the CL as the user that was signed in, so I kept having to add each new user to the directory. TIA.
    5,020 pointsBadges:
    report
  • Stark99
    I compiled the CL program under qsecofr. Presume any profile with all objects would be ok.
    50 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following