Results 1 to 7 of 7

Thread: Sending Mail through QProcess

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default Sending Mail through QProcess

    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:

    Qt Code:
    1. QString sALERT = "Your fly is unzipped"
    2. QString sEMAIL = [email]someemail@some.dom[/email]
    3. QString sCMD = "/bin/echo \'" + sALERT + "\' | /bin/mail -s \" SMART ALERT \" " + sEMAIL;
    4. QProcess pCVT;
    5. pCVT.execute(sCMD);
    6. QString sMsg;
    7. sMsg.setNum(pCVT.exitCode());
    8. logger("... EMAIL exit code: " + sMsg);
    9. 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
    Last edited by jpn; 13th August 2008 at 14:50. Reason: missing [code] tags

Similar Threads

  1. Sending Mail with attachment files
    By joy in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2008, 08:51
  2. sending encrypted data via mail using smtp
    By vermarajeev in forum General Programming
    Replies: 20
    Last Post: 14th August 2007, 19:47
  3. Sending a shortcut to an exec managed by QProcess ?
    By Ti_Thom in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2007, 17:31
  4. Sending mail using Qt
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2006, 11:17
  5. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.