Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Blame | Last modification | View Log | RSS feed

--- a/session/draft.c
+++ b/session/draft.c
@@ -1399,10 +1399,12 @@ char *draft_make_msg(struct draft *draft
     if (draft->from_address && draft->from_address[0]) {
         from_address = draft->from_address;
         use_sender = T;
-    } else
-        from_address
-            =
+    } else if (strchr(session->username, '@')) {
+        from_address = pool_strdup(pool, session->username);
+    } else {
+        from_address =
             pool_printf(pool, "%s@%s", session->username, default_domain);
+    }
 
     if (draft->from_personal && draft->from_personal[0]) {
         from_personal = draft->from_personal;
@@ -1431,9 +1433,14 @@ char *draft_make_msg(struct draft *draft
                               NIL);
     bputs(mb, "" CRLF);
 
-    if (use_sender)
-        bprintf(mb, "Sender: %s@%s" CRLF, session->username,
-                default_domain);
+    if (use_sender) {
+        if (strchr(session->username, '@')) {
+            bprintf(mb, "Sender: %s" CRLF, session->username);
+        } else {
+            bprintf(mb, "Sender: %s@%s" CRLF, session->username,
+                    default_domain);
+        }
+    }
 
     if (!(draft_make_abook_address(session, mb, "To", draft->to) &&
           draft_make_abook_address(session, mb, "Cc", draft->cc) &&
--- a/cmd/cmd_prefs.c
+++ b/cmd/cmd_prefs.c
@@ -474,9 +474,12 @@ generate_compose1_form(struct session *s
     template_vals_string(tvals, "from_address", prefs->from_address);
 
     if (!(prefs->from_address && prefs->from_address[0])) {
-        char *s = pool_printf(request->pool, "%s@%s",
-                              session->username, prefs->default_domain);
+        char *s = session->username;
 
+        if (!strchr(session->username, '@')) {
+            s = pool_printf(request->pool, "%s@%s",
+                            session->username, prefs->default_domain);
+        }
         template_vals_string(tvals, "default_from_address", s);
     }