Hey everyone, I'm about to write a script which would replace my existing php mime class / injector in to one written in C. This is custom code so I am not asking for direct help with it, but since its in C and will work with postfix exclusively, there's one part of it that would be good to hear options I have.
This will model my php script which uses phpmailer, so I'm going to try out Gmime (other suggestions welcome) to replace phpmailer as the mime class, but I'm trying to bypass making a socket connection to postfix and just inject the mail files directly in to the postfix queue directory myself. I know postfix has its own format (both in content and file permissions) and I could add the postfix library files/functions to my headers and reuse postfix's code for adding files to the queue. I've read/modified postfix code before, its great code to learn C from, so I'm hoping to just be pointed in the right direction as to which functions to look at. If the above isn't clear, here's an example: To send an email now, my script makes an smtp socket connection to my mail server, postfix accepts the email as incoming mail, then makes a queue file for that message and places that file in the queue to be sent as outbound mail where postfix makes the smtp connection to the destination. What I want it to do, is skip the first incoming smtp connection from my script to postfix, and instead just take my full email message and write the postfix format directly to the queue.to be sent outbound to the destination. Sendmail is not an option since its single threaded, and if this is a bad idea I can still do it the normal way in C and just send it to postfix using socket connections but I want to explore this option first because it seems, at least in theory, to be more efficient. Thanks for any advice on this, Paul