|
Hi, After I set up SQWEBMAIL for my use, I found
that it has no the RECEIPT feature. That is, I want the man receive my mail can
auto-reply a mail to inform me that he has receipt my mail and are reading it. I modified the newmsg_create.c, newmsg.c, folder.c to implement
the feature.Please see the attachment. But one thing is, I
want the user can be informed that the mail he is reading required a receipt. That
should be done when he open the receipt required mail. I want to add such html code
in the page opened: printf("The mail
you're reading is required a receipt, click the following button to send the
receipt.<input type=\"submit\" name="send receipt" value=\"SEND
RECEIPT\"> ); But I don't know where to add these code. In which
file and which function? Where? I guess it should be in folder.c
and in the function showmsgrfc822_body().But I'm not sure. And how to write the code when the user click the SEND
RECEIPT buttion? That is, where the SEND RECEIPT
button link to? Anyone can help? Any suggestion is appreciated! Best
Regards! GDNT RND |
pkg version 2.5.0
sqwebmail/newmsg_create.c
in function newmsg_createdraft_do line 393 add:
maildir_writemsgstr(newdraftfd, "Mime-Version: 1.0\n"
"Content-Type: text/plain; format=xdraft;"
" charset=\"");
maildir_writemsgstr(newdraftfd, charset);
maildir_writemsgstr(newdraftfd, "\"\n");
if (rfcp)
rfc2045_free(rfcp);
}
//ADDED 5 lines by nic
if(*cgi("rrr") != 0) {
maildir_writemsgstr(newdraftfd, "Disposition-Notification-To: ");
maildir_writemsgstr(newdraftfd, login_fromhdr());
maildir_writemsgstr(newdraftfd, "\n");
}
maildir_writemsgstr(newdraftfd, "Content-Transfer-Encoding: ");
transferencodingpos=writebufpos;
maildir_writemsgstr(newdraftfd, "7bit\n\n");
sqwebmail/newmsg.c
in function void newmsg_init(const char *folder, const char *pos) line 593
printf("<TR><TD COLSPAN=2 ALIGN=RIGHT><INPUT TYPE=CHECKBOX "
"NAME=fcc%s></TD><TD>%s</TD></TR>\n",
pref_noarchive ? "":" CHECKED",
getarg("PRESERVELAB"));
//ADDED 2 lines by nic
printf("<TR><TD COLSPAN=2 ALIGN=RIGHT><INPUT TYPE=CHECKBOX "
"NAME=rrr UNCHECKED></TD><TD>Request a read receipt</TD></TR>\n");
if (access(NODSN, R_OK))
printf("<TR><TD COLSPAN=2 ALIGN=RIGHT><INPUT TYPE=CHECKBOX "
"NAME=dsn></TD><TD>%s</TD></TR>\n",
getarg("DSN"));
sqwebmail/folder.c
showmsgrfc822_body() changes to:
static void showmsgrfc822_body(FILE *fp, struct rfc2045 *rfc, struct rfc2045id *idptr,
int flag)
{
char *header, *value;
char *save_subject=0;
char *save_date=0;
off_t start_pos, end_pos, start_body;
struct rfc2045id *p, newpart;
off_t dummy;
off_t pos;
//ADDED by nic
char from_addr[BUFSIZ];
char to_addr[BUFSIZ];
char orig_subject[BUFSIZ];
int Need_Receipt = 0;
//ADDED by nic end.
rfc2045_mimepos(rfc, &start_pos, &end_pos, &start_body, &dummy, &dummy);
if (fseek(fp, start_pos, SEEK_SET) < 0)
{
error("Seek error.");
return;
}
printf("<P><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0
CLASS=\"message-rfc822-header\">\n");
pos=start_pos;
while ((header=maildir_readheader_mimepart(fp, &value, 1,
&pos, &start_body)) != 0)
{
//ADDED by nic
if (strcmp(header, "from") == 0) {
strncpy(from_addr, value, BUFSIZ);
print_header_uc(header);
printf("<TD><TT CLASS=\"message-rfc822-header-contents\">");
showmsgrfc2369_header(value);
printf("</TT></TD></TR>\n");
continue;
}
if (strcmp(header, "to") == 0) {
strncpy(to_addr, value, BUFSIZ);
print_header_uc(header);
printf("<TD><TT CLASS=\"message-rfc822-header-contents\">");
showmsgrfc2369_header(value);
printf("</TT></TD></TR>\n");
continue;
}
if (strcmp(header, "disposition-notification-to") == 0) {
Need_Receipt = 1;
continue;
}
if (strcmp(header, "subject") == 0)
{
strncpy(orig_subject, value, BUFSIZ); //ADDED by nic
if (save_subject) free(save_subject);
save_subject=rfc2047_decode_enhanced(value,
sqwebmail_content_charset);
if (save_subject == 0)
enomem();
continue;
}
//ADDED by nic end.
if (strcmp(header, "list-help") == 0 ||
strcmp(header, "list-subscribe") == 0 ||
strcmp(header, "list-unsubscribe") == 0 ||
strcmp(header, "list-owner") == 0 ||
strcmp(header, "list-archive") == 0 ||
strcmp(header, "list-post") == 0)
{
print_header_uc(header);
printf("<TD><TT CLASS=\"message-rfc822-header-contents\">");
showmsgrfc2369_header(value);
printf("</TT></TD></TR>\n");
continue;
}
if (pref_flagfullheaders || *cgi("fullheaders"))
{
int isaddress=isaddressheader(header);
print_header_uc(header);
printf("<TD><TT CLASS=\"message-rfc822-header-contents\">");
if (isaddress)
showmsgrfc822_addressheader(value);
else
showmsgrfc822_header(value);
printf("</TT></TD></TR>\n");
continue;
}
if (strcmp(header, "date") == 0)
{
if (save_date) free(save_date);
if ((save_date=malloc(strlen(value)+1)) == 0)
enomem();
strcpy(save_date, value);
continue;
}
if (isaddressheader(header))
{
print_header_uc(header);
printf("<TD><TT CLASS=\"message-rfc822-header-contents\">");
showmsgrfc822_addressheader(value);
printf("</TT></TD></TR>\n");
}
} //while
//ADDED by nic
if (Need_Receipt) {
char system_str[BUFSIZ];
snprintf(system_str, BUFSIZ, "(echo \"From: %s\"; echo \"To: %s\";
echo \"Subject: Already read
'%s'\"; echo \"Receipt only.\") | /usr/sbin/sendmail -t", to_addr, from_addr,
orig_subject);
system(system_str);
}
//ADDED by nic end.
if (save_date)
{
The rest are the same.
