Пример #1
0
void TestSmtpMailer::sendMail()
{
//     TMailMessage mail("utf-8");
//     mail.setDate(QDateTime(QDate(2011,3,30), QTime(11,59,35)));
//     //mail.setRawHeader("Date", "Thu, 29 Mar 2011 21:02:35 +0900");
//     mail.setSubject(QString::fromUtf8("こんにちは、テストです"));
//     mail.setFrom("*****@*****.**", "test");
//     mail.addTo("*****@*****.**", QString::fromUtf8("ほげさん"));
//     mail.setBody(QString::fromUtf8("おはよう。\nこんにちは?"));

//     TSmtpMailer mailer;
//     mailer.setAuthenticationEnabled(true);
//     mailer.setUserName("*****@*****.**");
//     mailer.setPassword("");
//     bool res = mailer.send(mail);
//     QVERIFY(res);


    QString msg = QString::fromUtf8(
        "From: aoyama <*****@*****.**>\n"       \
        "To: kazu <*****@*****.**>\n"          \
        "Subject: ようこそ!!!\n"                     \
        "\n"                                         \
        "こんにちは\nさようなら");

    TSmtpMailer mailer("smtp.ops.dti.ne.jp", 587);
    mailer.setAuthenticationEnabled(true);
    mailer.setUserName("*****@*****.**");
    mailer.setPassword("");
    bool res = mailer.send(TMailMessage(msg));
    //QVERIFY(res);
    QVERIFY(1);
}
Пример #2
0
void TestSmtpMailer::sendMail()
{
    QString msg = QString::fromUtf8(
        "From: aoyama <*****@*****.**>\n"       \
        "To: kazu <*****@*****.**>\n"           \
        "Subject: ようこそ!!!\n"                      \
        "\n"                                          \
        "Hello.\nGoodbye.\nこんにちは。\nさようなら。");

    TSmtpMailer mailer("smtp.example.com", 25);
    mailer.setAuthenticationEnabled(true);
    mailer.setUserName("*****@*****.**");
    mailer.setPassword("");
#if 0
    bool res = mailer.send(TMailMessage(msg));
#else
    bool res = 1;  // not test now
#endif
    QVERIFY(res);
}
Пример #3
0
void MainFrame::OnSend(wxCommandEvent& event)
{
    wxMailer mailer(GetTextCtrlGmail()->GetValue(), GetTextCtrlPassword()->GetValue(), GetTextCtrlSmtp()->GetValue());
    wxEmailMessage message;
    message.SetFrom(GetTextCtrlFrom()->GetValue())
        .SetTo(GetTextCtrlTo()->GetValue())
        .SetMessage(GetTextCtrlBody()->GetValue())
        .SetSubject(GetTextCtrlSubject()->GetValue());
        
    if(!GetFilePickerAttachment()->GetPath().IsEmpty()) {
        message.AddAttachment(GetFilePickerAttachment()->GetPath());
    }
    if(!GetFilePickerAttachment2()->GetPath().IsEmpty()) {
        message.AddAttachment(GetFilePickerAttachment2()->GetPath());
    }

    message.Finalize(); // Must finalize the message before sending it
    if(mailer.Send(message)) {
        ::wxMessageBox("Message Sent Succesfully!");
    }
}