aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mailutils/sendmail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 824109d99..9455b4e7a 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -326,7 +326,6 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
326 // we should start with modern EHLO 326 // we should start with modern EHLO
327 if (250 != smtp_checkp("EHLO %s", host, -1)) 327 if (250 != smtp_checkp("EHLO %s", host, -1))
328 smtp_checkp("HELO %s", host, 250); 328 smtp_checkp("HELO %s", host, 250);
329 free(host);
330 329
331 // perform authentication 330 // perform authentication
332 if (opts & OPT_a) { 331 if (opts & OPT_a) {
@@ -353,8 +352,11 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
353 352
354 // got no sender address? use auth name, then UID username as a last resort 353 // got no sender address? use auth name, then UID username as a last resort
355 if (!opt_from) { 354 if (!opt_from) {
356 opt_from = G.user ? G.user : xuid2uname(getuid()); 355 opt_from = xasprintf("%s@%s",
356 G.user ? G.user : xuid2uname(getuid()),
357 xgethostbyname(host)->h_name);
357 } 358 }
359 free(host);
358 360
359 smtp_checkp("MAIL FROM:<%s>", opt_from, 250); 361 smtp_checkp("MAIL FROM:<%s>", opt_from, 250);
360 362