smtp-client.c revision 2d0ebf1c0259ec9a27c4e088ac50824cb377f7a7
89a126810703c666309310d0f3189e9834d70b5bTimo Sirainen/* Copyright (C) 2006 Timo Sirainen */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstatic struct smtp_client *smtp_client_devnull(FILE **file_r)
024815ea2ffdda9ea79919f18e865663977f73eaTimo Sirainen client->f = *file_r = fopen("/dev/null", "w");
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainensmtp_client_run_sendmail(const char *destination,
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen /* deliver_set's contents may point to environment variables.
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainen deliver_env_clean() cleans them up, so they have to be copied. */
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen sendmail_path = t_strdup(deliver_set->sendmail_path);
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen argv[3] = return_path != NULL && *return_path != '\0' ?
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainen i_fatal("execv(%s) failed: %m", sendmail_path);
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenstruct smtp_client *smtp_client_open(const char *destination,
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen smtp_client_run_sendmail(destination, return_path, fd[0]);
eac3948d67eff8623d51aeaea9eca582f3aec677Timo Sirainenint smtp_client_close(struct smtp_client *client)
a2cbf1d392ee983520451bc9b849a490f28ac298Timo Sirainen /* smtp_client_open() failed already */
eac3948d67eff8623d51aeaea9eca582f3aec677Timo Sirainen } else if (waitpid(client->pid, &status, 0) < 0)
123962e68d25c1c5b04160d70f65ef6a66298d40Timo Sirainen i_error("Sendmail process terminated abnormally, "
123962e68d25c1c5b04160d70f65ef6a66298d40Timo Sirainen i_error("Sendmail process terminated abnormally, "
eac3948d67eff8623d51aeaea9eca582f3aec677Timo Sirainen i_error("Sendmail process stopped, signal %d",
eac3948d67eff8623d51aeaea9eca582f3aec677Timo Sirainen i_error("Sendmail process terminated abnormally, "