diff --git a/reference/SMTP/SMTP.cpp b/reference/SMTP/SMTP.cpp new file mode 100644 index 000000000..53b122e5a --- /dev/null +++ b/reference/SMTP/SMTP.cpp @@ -0,0 +1,33 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ +// Smtp::Trace(); + for(;;) { + Cout() << "Send email to: "; + String to = ReadStdIn(); + if(IsNull(to)) + break; + Cout() << "Your full email address: "; + String user = ReadStdIn(); + Cout() << "Your Gmail password: "; + String pwd = ReadStdIn(); + Smtp mail; + mail.Host("smtp.gmail.com") + .Port(465) + .SSL(); + mail + .Auth(user, pwd) + .To(to) + .Subject("Test message") + .Text("Hello world!") + .Attach("somedata.txt", "This is a test of String attachement") + .AttachFile(GetDataFile("SMTP.cpp")); + if(mail.Send()) + Cout() << "OK\n"; + else + Cout() << "Failed: " << mail.GetError() << '\n'; + } +} diff --git a/reference/SMTP/SMTP.upp b/reference/SMTP/SMTP.upp new file mode 100644 index 000000000..ddc86427b --- /dev/null +++ b/reference/SMTP/SMTP.upp @@ -0,0 +1,13 @@ +description "Using Core/SMTP to send email via gmail\377"; + +uses + Core, + Core/SMTP, + Core/SSL; + +file + SMTP.cpp; + +mainconfig + "" = "SSE2"; + diff --git a/reference/SMTP/init b/reference/SMTP/init new file mode 100644 index 000000000..4bfff12f8 --- /dev/null +++ b/reference/SMTP/init @@ -0,0 +1,6 @@ +#ifndef _SMTP_icpp_init_stub +#define _SMTP_icpp_init_stub +#include "Core/init" +#include "Core/SMTP/init" +#include "Core/SSL/init" +#endif