2020-11-18 Fred Gleason <fredg@paravelsystems.com>

* Added a '--dry-run' switch to the 'sendmail_test' test harness.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2020-11-19 12:14:30 -05:00
parent aba286e097
commit 55db0e4dd9
5 changed files with 26 additions and 7 deletions

View File

@@ -41,6 +41,7 @@ MainObject::MainObject(QObject *parent)
QString bcc_addrs;
QString subject;
QString body;
bool dry_run=false;
//
// Read Command Options
@@ -73,6 +74,10 @@ MainObject::MainObject(QObject *parent)
body=cmd->value(i);
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--dry-run") {
dry_run=true;
cmd->setProcessed(i,true);
}
if(!cmd->processed(i)) {
fprintf(stderr,"sendmail_test: unknown option \"%s\"\n",
(const char *)cmd->key(i));
@@ -80,7 +85,8 @@ MainObject::MainObject(QObject *parent)
}
}
if(!RDSendMail(&err_msg,subject,body,from_addr,to_addrs,cc_addrs,bcc_addrs)) {
if(!RDSendMail(&err_msg,subject,body,
from_addr,to_addrs,cc_addrs,bcc_addrs,dry_run)) {
fprintf(stderr,"%s\n",err_msg.toUtf8().constData());
exit(256);
}

View File

@@ -23,7 +23,7 @@
#include <qobject.h>
#define SENDMAIL_TEST_USAGE "[options]\n\nTest the Rivendell email sending routines\n\nOptions are:\n--from-address=<addr>\n Originating email address\n\n--to-addresses=<addrs>\n To addresses (comma seperated)\n\n--cc-addresses=<addrs>\n CC addresses (comma seperated)\n\n--bcc-addresses=<addrs>\n BCC addresses (comma seperated)\n\n--subject=<str>\n Message subject\n\n--body=<str>\n Message body\n\n"
#define SENDMAIL_TEST_USAGE "[options]\n\nTest the Rivendell email sending routines\n\nOptions are:\n--from-address=<addr>\n Originating email address\n\n--to-addresses=<addrs>\n To addresses (comma seperated)\n\n--cc-addresses=<addrs>\n CC addresses (comma seperated)\n\n--bcc-addresses=<addrs>\n BCC addresses (comma seperated)\n\n--subject=<str>\n Message subject\n\n--body=<str>\n Message body\n\n--dry-run\n Print the raw message to STDOUT, then exit\n\n"
class MainObject : public QObject
{