The C submission binding is the fourth of five in the chapter: the same operations as in C++, but as functions with the common prefixes PmtaConn, PmtaMsg and PmtaRcpt in the headers submitter/PmtaConn.h, PmtaMsg.h and PmtaRcpt.h.
The difference is in object lifetime and errors: an object is allocated with an …Alloc function, initialized, and freed with …Free when done; functions return a success flag, and the reason is given by …GetLastError.
Connecting takes two functions: PmtaConnConnectRemote without login and PmtaConnConnectRemoteAuth with a login and password; the old PmtaConnConnect is deprecated.
The order of working with an object:
| Step | Connection | Message |
|---|---|---|
| allocate | PmtaConnAlloc | PmtaMsgAlloc |
| initialize | PmtaConnConnectRemote | PmtaMsgInit |
| find out the error reason | PmtaConnGetLastError | PmtaMsgGetLastError |
| free | PmtaConnFree | PmtaMsgFree |
# connect to the node with a login and password PmtaConn conn = PmtaConnAlloc(); PmtaConnConnectRemoteAuth(conn, "10.0.0.5", 25, "user", "secret");
3 relations
Object lifetime in the C bindingA related mechanism: they work together. § 7.5.1
ls /opt/pmta/api/include/submitter/
3 articles
◇How a message gets into the engineSix described submission methods: extended SMTP, four language bindings and a directory the node watches on disk.◇Who is allowed to submit mail and for whom to accept itOut of the box, the node accepts submission only from the machine itself; two different questions — “who can send through us” and “for whose addresses we accept mail” — are answered by different directives.◇Headers the sender uses to control deliverySix control headers let the submitting side choose a stream, tag a message with a job, set signing options and the key, the envelope identifier and the schedule; each is allowed separately and per source.