Answer the question
In order to leave comments, you need to log in
How to send email further in sendmail after stub?
Hello.
I'm trying to make some layer for emails in php 7.0 in order to subject them to a little processing and most importantly - limiting outgoing emails. In php.ini, I redirected the letters to my file, where I opened the stdin stream and took the necessary data, entered it into a table, and calculated it. Now I need to send them back, and send them further in the same stream to sendmail. I googled this for a very long time and still haven't found a solution.
PS I do everything locally in docker, I don’t have a mail server, I have Postfix (in fact, you can send it to postfix, but here I can’t even understand how), maybe later I will configure all this on the server.
PSS I don't need similar solutions to the whole problem, I need to do just that.
Here is a cut off part of the code, without logic and other things, the most necessary for understanding the issue.
#!/usr/bin/php
<?php
$stream = '';
$fp = fopen('php://stdin','r');
while($t=fread($fp,2048))
{
if( $t===chr(0) )
break;
$stream .= $t;
}
//$count_mails - количество писем с определенного домена.
if($count_mails > 50){
exit(0);
}
//вот здесь должно быть что-то что отправит письма дальше после всех изысканий.
Answer the question
In order to leave comments, you need to log in
Hello, the solution was the line:
That is, we sent the stream further to sendmail, where it actually went.
I caught the letters using a fake mail server, as soon as the idea came up to install it, the solution was found quickly by poking and testing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question