]> granicus.if.org Git - mutt/commitdiff
Test that envelope from or from is set before attempting SMTP delivery.
authorBrendan Cully <brendan@kublai.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerBrendan Cully <brendan@kublai.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
Closes #3079.

smtp.c

diff --git a/smtp.c b/smtp.c
index 654f4aa9834a38e7ec986237a8001a5ae2c779e9..59c3f4fdb4a857a950a874231d4f2230697becc6 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -210,8 +210,21 @@ mutt_smtp_send (const ADDRESS* from, const ADDRESS* to, const ADDRESS* cc,
 {
   CONNECTION *conn;
   ACCOUNT account;
-  int ret = -1;
+  const char* envfrom;
   char buf[1024];
+  int ret = -1;
+
+  /* it might be better to synthesize an envelope from from user and host
+   * but this condition is most likely arrived at accidentally */
+  if (EnvFrom)
+    envfrom = EnvFrom->mailbox;
+  else if (from)
+    envfrom = from->mailbox;
+  else
+  {
+    mutt_error (_("No from address given"));
+    return -1;
+  }
 
   if (smtp_fill_account (&account) < 0)
     return ret;