mymail.cpp
来自「一个在redhat下面做的邮件收发程序」· C++ 代码 · 共 57 行
CPP
57 行
//mymail.cpp#include <iostream>#include <cstring>#include "MySmtp.h"#define _DEBUGusing namespace std;int main(){ string Mailto; string Subject; string Body; string buf; string filepath; MySmtp mymail; #ifndef _DEBUG cout << "Mail to:"; cin >> Mailto; cout << "Subject:" << endl; cin >> Subject; cout << "body:(end with EOF)" << endl; while(1) { getline(cin,buf); if(buf == "EOF") break; Body.append(buf); Body.append("\r\n"); } cout << "input the additional file path:" << endl; getline(cin,filepath); #endif #ifdef _DEBUG Mailto = "EricCN@126.com"; Subject = "addition test"; Body = "this is the body!\r\n"; filepath = "/root/C/filename"; #endif cout << "the mail is sending,please wait!" << endl; mymail.SetMailTo(Mailto); mymail.SetSubject(Subject); mymail.SetMailBody(Body); if(strlen(filepath.c_str()) > 0) mymail.SetFilePath(filepath); if(mymail.SendMail() < 0) cout << mymail.GetErr() <<endl; cout << "The mail has send succesfully!" << endl; return 1;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?