Lines 60-65
Link Here
|
60 |
static char *from_addr = NULL; |
60 |
static char *from_addr = NULL; |
61 |
static char *mailhost = NULL; |
61 |
static char *mailhost = NULL; |
62 |
static int mailport = 25; |
62 |
static int mailport = 25; |
|
|
63 |
static int full_mail = 0; |
63 |
static char *reply_addr = 0; |
64 |
static char *reply_addr = 0; |
64 |
static char *subject = 0; |
65 |
static char *subject = 0; |
65 |
static int mime_style = 0; |
66 |
static int mime_style = 0; |
Lines 120-125
Link Here
|
120 |
fprintf(stderr, " -V, --version display version string\n"); |
121 |
fprintf(stderr, " -V, --version display version string\n"); |
121 |
fprintf(stderr, " -h, --help display this page\n"); |
122 |
fprintf(stderr, " -h, --help display this page\n"); |
122 |
fprintf(stderr, "\n"); |
123 |
fprintf(stderr, "\n"); |
|
|
124 |
fprintf(stderr, "Sendmail -ot faking:\n"); |
125 |
fprintf(stderr, " -F, --full-mail input is a full mail, so the original headers will remain unchanged\n"); |
126 |
fprintf(stderr, "\n"); |
123 |
return; |
127 |
return; |
124 |
} |
128 |
} |
125 |
|
129 |
|
Lines 290-295
Link Here
|
290 |
{ "smtp-port", 1, NULL, 'p' }, |
294 |
{ "smtp-port", 1, NULL, 'p' }, |
291 |
{ "mime-encode", 0, NULL, 'M' }, |
295 |
{ "mime-encode", 0, NULL, 'M' }, |
292 |
{ "use-syslog", 0, NULL, 'L' }, |
296 |
{ "use-syslog", 0, NULL, 'L' }, |
|
|
297 |
{ "full-mail", 0, NULL, 'F' }, |
293 |
{ "verbose", 0, NULL, 'v' }, |
298 |
{ "verbose", 0, NULL, 'v' }, |
294 |
{ "version", 0, NULL, 'V' }, |
299 |
{ "version", 0, NULL, 'V' }, |
295 |
{ "help", 0, NULL, 'h' } |
300 |
{ "help", 0, NULL, 'h' } |
Lines 317-323
Link Here
|
317 |
/* |
322 |
/* |
318 |
* Parse options |
323 |
* Parse options |
319 |
*/ |
324 |
*/ |
320 |
while ((c = getopt_long(argc, argv, ":s:f:r:e:c:S:P:MLvVh", options, NULL)) != EOF) { |
325 |
while ((c = getopt_long(argc, argv, ":s:f:r:e:c:S:P:FMLvVh", options, NULL)) != EOF) { |
321 |
switch (c) { |
326 |
switch (c) { |
322 |
case 's': |
327 |
case 's': |
323 |
subject = optarg; |
328 |
subject = optarg; |
Lines 340-345
Link Here
|
340 |
case 'P': |
345 |
case 'P': |
341 |
mailport = atoi(optarg); |
346 |
mailport = atoi(optarg); |
342 |
break; |
347 |
break; |
|
|
348 |
case 'F': |
349 |
full_mail = 1; |
350 |
break; |
343 |
case 'M': |
351 |
case 'M': |
344 |
mime_style = 1; |
352 |
mime_style = 1; |
345 |
break; |
353 |
break; |
Lines 460-494
Link Here
|
460 |
/* |
468 |
/* |
461 |
* Give out Message header. |
469 |
* Give out Message header. |
462 |
*/ |
470 |
*/ |
463 |
fprintf(sfp, "From: %s\r\n", from_addr); |
471 |
if (!full_mail) { // As long as user dont want to provide full mail |
464 |
if (subject) |
472 |
fprintf(sfp, "From: %s\r\n", from_addr); |
465 |
fprintf(sfp, "Subject: %s\r\n", subject); |
473 |
if (subject) |
466 |
|
474 |
fprintf(sfp, "Subject: %s\r\n", subject); |
467 |
if (reply_addr) |
475 |
|
|
|
476 |
if (reply_addr) |
468 |
fprintf(sfp, "Reply-To: %s\r\n", reply_addr); |
477 |
fprintf(sfp, "Reply-To: %s\r\n", reply_addr); |
469 |
if (err_addr) |
478 |
if (err_addr) |
470 |
fprintf(sfp, "Errors-To: %s\r\n", err_addr); |
479 |
fprintf(sfp, "Errors-To: %s\r\n", err_addr); |
471 |
if ((pwd = getpwuid(getuid())) == 0) { |
480 |
if ((pwd = getpwuid(getuid())) == 0) { |
472 |
fprintf(sfp, "Sender: userid-%d@%s\r\n", getuid(), my_name); |
481 |
fprintf(sfp, "Sender: userid-%d@%s\r\n", getuid(), my_name); |
473 |
} else { |
482 |
} else { |
474 |
fprintf(sfp, "Sender: %s@%s\r\n", pwd->pw_name, my_name); |
483 |
fprintf(sfp, "Sender: %s@%s\r\n", pwd->pw_name, my_name); |
475 |
} |
484 |
} |
476 |
|
485 |
|
477 |
fprintf(sfp, "To: %s", argv[optind]); |
486 |
fprintf(sfp, "To: %s", argv[optind]); |
478 |
for (i = optind + 1; i < argc; i++) |
487 |
for (i = optind + 1; i < argc; i++) |
479 |
fprintf(sfp, ",%s", argv[i]); |
488 |
fprintf(sfp, ",%s", argv[i]); |
480 |
fprintf(sfp, "\r\n"); |
489 |
fprintf(sfp, "\r\n"); |
481 |
if (cc_addr) |
490 |
if (cc_addr) |
482 |
fprintf(sfp, "Cc: %s\r\n", cc_addr); |
491 |
fprintf(sfp, "Cc: %s\r\n", cc_addr); |
483 |
|
492 |
|
484 |
if (mime_style) { |
493 |
if (mime_style) { |
485 |
fprintf(sfp, "MIME-Version: 1.0\r\n"); |
494 |
fprintf(sfp, "MIME-Version: 1.0\r\n"); |
486 |
fprintf(sfp, "Content-Type: text/plain; charset=ISO-8859-1\r\n"); |
495 |
fprintf(sfp, "Content-Type: text/plain; charset=ISO-8859-1\r\n"); |
487 |
fprintf(sfp, "Content-Transfer-Encoding: quoted-printable\r\n"); |
496 |
fprintf(sfp, "Content-Transfer-Encoding: quoted-printable\r\n"); |
|
|
497 |
} |
498 |
|
499 |
fprintf(sfp, "\r\n"); |
488 |
} |
500 |
} |
489 |
|
501 |
|
490 |
fprintf(sfp, "\r\n"); |
|
|
491 |
|
492 |
/* |
502 |
/* |
493 |
* Give out Message body. |
503 |
* Give out Message body. |
494 |
*/ |
504 |
*/ |