-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
71 lines (64 loc) · 1.97 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "CSmtp.h"
#include <iostream>
int main()
{
bool bError = false;
try
{
CSmtp mail;
#define test_yandex_ssl
#if defined(test_gmail_tls)
mail.SetSMTPServer("smtp.gmail.com",587);
mail.SetSecurityType(CSmtp::USE_TLS);
#elif defined(test_gmail_ssl)
mail.SetSMTPServer("smtp.gmail.com",465);
mail.SetSecurityType(CSmtp::USE_SSL);
#elif defined(test_hotmail_TLS)
mail.SetSMTPServer("smtp.live.com",25);
mail.SetSecurityType(CSmtp::USE_TLS);
#elif defined(test_aol_tls)
mail.SetSMTPServer("smtp.aol.com",587);
mail.SetSecurityType(CSmtp::USE_TLS);
#elif defined(test_yahoo_ssl)
mail.SetSMTPServer("plus.smtp.mail.yahoo.com",465);
mail.SetSecurityType(CSmtp::USE_SSL);
#elif defined(test_yandex_ssl)
mail.SetSMTPServer("smtp.yandex.ru",465);
mail.SetSecurityType(CSmtp::USE_SSL);
#elif defined(test_yandex_no_security)
mail.SetSMTPServer("smtp.yandex.ru",25);
mail.SetSecurityType(CSmtp::NO_SECURITY);
// mail.SetSecurityType(CSmtp::USE_TSL);
#endif
mail.SetLogin("borev.borev");
mail.SetPassword("borevborev");
mail.SetSenderName("борев");
mail.SetSenderMail("[email protected]");
mail.SetReplyTo("[email protected]");
mail.SetSubject("сообщение");
mail.AddRecipient("[email protected]");
mail.SetXPriority(XPRIORITY_NORMAL);
mail.SetXMailer("The Bat! (v3.02) Professional");
mail.AddMsgLine("Здрасте,");
mail.AddMsgLine("");
mail.AddMsgLine("...");
mail.AddMsgLine("фыфывафывафывафыва?");
mail.AddMsgLine("");
mail.AddMsgLine("фывафывафыва");
mail.ModMsgLine(5,"regards");
mail.DelMsgLine(2);
mail.AddMsgLine("фывафываф");
//mail.AddAttachment("../test1.jpg");
//mail.AddAttachment("c:\\test2.exe");
//mail.AddAttachment("c:\\test3.txt");
mail.Send();
}
catch(ECSmtp e)
{
std::cout << "Error: " << e.GetErrorText().c_str() << ".\n";
bError = true;
}
if(!bError)
std::cout << "Mail was send successfully.\n";
return 0;
}