summaryrefslogtreecommitdiffstats
path: root/mbbsd/mail.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-16 18:53:40 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-16 18:53:40 +0800
commite20bd69d66148c34fee47e1f1f372963a871c047 (patch)
tree96f18d561f95892630b60c4f9ab0f7135c312d61 /mbbsd/mail.c
parente9c609d85c53f5a03a08942d65432bb7880b28ed (diff)
downloadpttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.gz
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.bz2
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.lz
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.xz
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.zst
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.zip
- change sender address of auto forward to forwarder, to prevent confusion caused by incorrect forward settings.
- (internal) change bsmtp to allow assigning from address git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4173 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r--mbbsd/mail.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 6cde69f7..2fa6f894 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -422,12 +422,7 @@ do_send(const char *userid, const char *title)
break;
default:
outs("Y\n請稍候, 信件傳遞中...\n");
- res =
-#ifndef USE_BSMTP
- bbs_sendmail(fpath, save_title, userid);
-#else
- bsmtp(fpath, save_title, userid);
-#endif
+ res = bsmtp(fpath, save_title, userid, NULL);
hold_mail(fpath, userid);
}
unlink(fpath);
@@ -1901,12 +1896,15 @@ bbs_sendmail(const char *fpath, const char *title, char *receiver)
#else /* USE_BSMTP */
int
-bsmtp(const char *fpath, const char *title, const char *rcpt)
+bsmtp(const char *fpath, const char *title, const char *rcpt, const char *from)
{
char buf[80], *ptr;
time4_t chrono;
MailQueue mqueue;
+ if (!from)
+ from = cuser.userid;
+
/* check if the mail is a inner mail */
if ((ptr = strstr(rcpt, str_mail_address)) || !strchr(rcpt, '@')) {
char hacker[20];
@@ -1939,8 +1937,10 @@ bsmtp(const char *fpath, const char *title, const char *rcpt)
// XXX (unused) mqueue.method = method;
strlcpy(mqueue.filepath, fpath, sizeof(mqueue.filepath));
strlcpy(mqueue.subject, title, sizeof(mqueue.subject));
- strlcpy(mqueue.sender, cuser.userid, sizeof(mqueue.sender));
- strlcpy(mqueue.username, cuser.nickname, sizeof(mqueue.username));
+ strlcpy(mqueue.sender, from, sizeof(mqueue.sender));
+ // username is deprecated: why use it?
+ // strlcpy(mqueue.username, username, sizeof(mqueue.username));
+ strlcpy(mqueue.username, "", sizeof(mqueue.username));
strlcpy(mqueue.rcpt, rcpt, sizeof(mqueue.rcpt));
if (append_record("out/" FN_DIR, (fileheader_t *) & mqueue, sizeof(mqueue)) < 0)
@@ -2035,12 +2035,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
} else
return -1;
- return_no =
-#ifndef USE_BSMTP
- bbs_sendmail(fname, fh->title, address);
-#else
- bsmtp(fname, fh->title, address);
-#endif
+ return_no = bsmtp(fname, fh->title, address, NULL);
unlink(fname);
return (return_no);
}