QT: 4.3.3
OS: RHEL 5
I am attempting to send email by running the mail command from QProcess. Here is my code snippet:
QString sALERT
= "Your fly is unzipped" QString sEMAIL
= [email
]someemail@some.
dom[/email
] QString sCMD
= "/bin/echo \'" + sALERT
+ "\' | /bin/mail -s \" SMART ALERT \" " + sEMAIL;
pCVT.execute(sCMD);
sMsg.setNum(pCVT.exitCode());
logger("... EMAIL exit code: " + sMsg);
logger(sCMD);
QString sALERT = "Your fly is unzipped"
QString sEMAIL = [email]someemail@some.dom[/email]
QString sCMD = "/bin/echo \'" + sALERT + "\' | /bin/mail -s \" SMART ALERT \" " + sEMAIL;
QProcess pCVT;
pCVT.execute(sCMD);
QString sMsg;
sMsg.setNum(pCVT.exitCode());
logger("... EMAIL exit code: " + sMsg);
logger(sCMD);
To copy to clipboard, switch view to plain text mode
logger is a method that appends the current DateTime and the QString to a file.
The exit code comes back as 0.
If I copy and paste the command to a UNIX shell and run it, it works.
However, when I run the QT code, I get the outputs in the log file but no email.
Can anyone see anything obviously wrong?
Thanks,
Karl
Bookmarks