//
//  main.c
//  GmailEmailCommandLine
//
//  Created by Robert Metcalfe on 29/07/13.
//  Copyright (c) 2013 Robert Metcalfe. All rights reserved.
//

#ifdef TARGET_OS_MAC
// Mac Includes Here
#endif

#ifdef __linux__
// Linux Includes Here
#endif

#ifdef _WIN32 
// Windows 32bit Includes Here
#endif

#ifdef _WIN64
// Windows 64bit Includes Here
#endif

#include <stdio.h>

int main(int argc, const char * argv[])
{
    int isWindows = 0;
#ifdef _WIN64
    // Windows 64bit code Here
    isWindows = 64;
#endif
#ifdef _WIN32
    // Windows 32bit code Here
    isWindows = 32;
#endif
    if (isWindows != 0) {
        system("echo Subject: This is a Windows email about sending an email from the command line > myemail.txt");
        system("echo To Whom It May Concern, >> myemail.txt");
        system("echo. >> myemail.txt");
        system("echo I am concerned that you are concerned, and that concerns me. >> myemail.txt");
        system("echo. >> myemail.txt");
        system("echo I am sorry, but just taking a Bex and lying down just does not hack it for me regarding this problem. >> myemail.txt");
        system("echo. >> myemail.txt");
        system("echo Look forward to your continuing concern, but please do not concern yourself, about this matter. >> myemail.txt");
        system("echo. >> myemail.txt");
        system("echo Yours sincerely, >> myemail.txt");
        system("echo. >> myemail.txt");
        system("echo Worry Wort >> myemail.txt");
        system("type myemail.txt");
        system("SmtpGmailEmail.exe rmetcalfe15@gmail.com passwordGoesHere myemail.txt"); // SmtpGmailEmail.exe is VB.Net needing to be placed into the Windows PATH
    } else {
        system("echo Subject: This is a Mac email about sending an email from the command line > myemail.txt");
        system("echo To Whom It May Concern, >> myemail.txt");
        system("echo \"\" >> myemail.txt");
        system("echo I am concerned that you are concerned, and that concerns me. >> myemail.txt");
        system("echo \"\" >> myemail.txt");
        system("echo I am sorry, but just taking a Bex and lying down just does not hack it for me regarding this problem. >> myemail.txt");
        system("echo \"\" >> myemail.txt");
        system("echo Look forward to your continuing concern, but please do not concern yourself, about this matter. >> myemail.txt");
        system("echo \"\" >> myemail.txt");
        system("echo Yours sincerely, >> myemail.txt");
        system("echo \"\" >> myemail.txt");
        system("echo Worry Wort >> myemail.txt");
    }
#ifdef __linux__
    // Linux Code Here
    system("sendmail rmetcalfe15@gmail.com < myemail.txt");
    system("cat myemail.txt");
#endif
#ifdef TARGET_OS_MAC
    // Mac Code Here
    system("sendmail rmetcalfe15@gmail.com < myemail.txt");
    system("cat myemail.txt");
#endif
    system("echo Email as above sent to rmetcalfe15@gmail.com ");
    return 0;
}

