72 |
"the data part of the protocol transaction will also be printed to stdout.\n"); |
"the data part of the protocol transaction will also be printed to stdout.\n"); |
73 |
|
|
74 |
static struct argp_option options[] = { |
static struct argp_option options[] = { |
75 |
{"from", 'f', N_("ADDR"), 0, N_("Override the default from address\n")}, |
{"from", 'f', N_("ADDR"), 0, N_("Override the default from address")}, |
76 |
{"debug", 'd', NULL, 0, N_("Enable debugging output")}, |
{"debug", 'd', NULL, 0, N_("Enable debugging output")}, |
77 |
{ 0, 'o', "OPT", OPTION_HIDDEN, N_("Ignored for sendmail compatibility")}, |
{ 0, 'o', "OPT", OPTION_HIDDEN, N_("Ignored for sendmail compatibility")}, |
78 |
{0} |
{0} |
148 |
{ |
{ |
149 |
if ((status = address_create (&from, optfrom))) |
if ((status = address_create (&from, optfrom))) |
150 |
{ |
{ |
151 |
fprintf (stderr, _("Parsing from addresses failed: %s\n"), |
mu_error (_("Parsing from addresses failed: %s"), |
152 |
mu_strerror (status)); |
mu_strerror (status)); |
153 |
goto end; |
goto end; |
154 |
} |
} |
155 |
} |
} |
160 |
|
|
161 |
if ((status = address_createv (&to, (const char **) av, -1))) |
if ((status = address_createv (&to, (const char **) av, -1))) |
162 |
{ |
{ |
163 |
fprintf (stderr, _("Parsing to addresses failed: %s\n"), |
mu_error (_("Parsing to addresses failed: %s"), |
164 |
mu_strerror (status)); |
mu_strerror (status)); |
165 |
goto end; |
goto end; |
166 |
} |
} |
167 |
} |
} |
168 |
|
|
169 |
if ((status = stdio_stream_create (&in, stdin, MU_STREAM_SEEKABLE))) |
if ((status = stdio_stream_create (&in, stdin, MU_STREAM_SEEKABLE))) |
170 |
{ |
{ |
171 |
fprintf (stderr, _("Failed: %s\n"), mu_strerror (status)); |
mu_error (_("Failed: %s"), mu_strerror (status)); |
172 |
goto end; |
goto end; |
173 |
} |
} |
174 |
|
|
175 |
if ((status = stream_open (in))) |
if ((status = stream_open (in))) |
176 |
{ |
{ |
177 |
fprintf (stderr, _("Opening stdin failed: %s\n"), mu_strerror (status)); |
mu_error (_("Opening stdin failed: %s"), mu_strerror (status)); |
178 |
goto end; |
goto end; |
179 |
} |
} |
180 |
|
|
181 |
if ((status = message_create (&msg, NULL))) |
if ((status = message_create (&msg, NULL))) |
182 |
{ |
{ |
183 |
fprintf (stderr, _("Failed: %s\n"), mu_strerror (status)); |
mu_error (_("Failed: %s"), mu_strerror (status)); |
184 |
goto end; |
goto end; |
185 |
} |
} |
186 |
|
|
187 |
if ((status = message_set_stream (msg, in, NULL))) |
if ((status = message_set_stream (msg, in, NULL))) |
188 |
{ |
{ |
189 |
fprintf (stderr, _("Failed: %s\n"), |
mu_error (_("Failed: %s"), mu_strerror (status)); |
|
mu_strerror (status)); |
|
190 |
goto end; |
goto end; |
191 |
} |
} |
192 |
|
|
194 |
{ |
{ |
195 |
const char *url = NULL; |
const char *url = NULL; |
196 |
mailer_get_url_default (&url); |
mailer_get_url_default (&url); |
197 |
fprintf (stderr, _("Creating mailer '%s' failed: %s\n"), |
mu_error (_("Creating mailer '%s' failed: %s"), |
198 |
url, mu_strerror (status)); |
url, mu_strerror (status)); |
199 |
goto end; |
goto end; |
200 |
} |
} |
201 |
|
|
213 |
{ |
{ |
214 |
const char *url = NULL; |
const char *url = NULL; |
215 |
mailer_get_url_default (&url); |
mailer_get_url_default (&url); |
216 |
fprintf (stderr, _("Opening mailer '%s' failed: %s\n"), |
mu_error (_("Opening mailer '%s' failed: %s"), |
217 |
url, mu_strerror (status)); |
url, mu_strerror (status)); |
218 |
goto end; |
goto end; |
219 |
} |
} |
220 |
|
|
221 |
if ((status = mailer_send_message (mailer, msg, from, to))) |
if ((status = mailer_send_message (mailer, msg, from, to))) |
222 |
{ |
{ |
223 |
fprintf (stderr, _("Sending message failed: %s\n"), mu_strerror (status)); |
mu_error (_("Sending message failed: %s"), mu_strerror (status)); |
224 |
goto end; |
goto end; |
225 |
} |
} |
226 |
|
|
227 |
if ((status = mailer_close (mailer))) |
if ((status = mailer_close (mailer))) |
228 |
{ |
{ |
229 |
fprintf (stderr, _("Closing mailer failed: %s\n"), mu_strerror (status)); |
mu_error (_("Closing mailer failed: %s"), mu_strerror (status)); |
230 |
goto end; |
goto end; |
231 |
} |
} |
232 |
|
|