Exemplo n.º 1
0
void WsNewsLetter::sendConfirmMail(const std::string& email,
                                       const std::string& userToken) const
{
  std::string url = "/newsletter/subscribe/";
  WApplication *app = WApplication::instance();
  url = app->makeAbsoluteUrl(app->bookmarkUrl(url)) + userToken;

  Mail::Message message;

  message.addRecipient(Mail::To, Mail::Mailbox(email));
  message.setSubject(WString::tr("subject"));
  message.setBody(WString::tr("body").arg(email).arg(url));
  message.addHtmlBody(WString::tr("htmlbody").arg(email).arg(url));

  sendMail(message);
}
Exemplo n.º 2
0
void WsNewsLetter::sendMail(const Mail::Message& message) const
{
  Mail::Message m = message;

  if (m.from().empty()) {
    std::string senderName = "Ws letter module";
    std::string senderAddress = "*****@*****.**";

    m.setFrom(Mail::Mailbox(senderAddress, WString::fromUTF8(senderName)));
  }

  m.write(std::cout);

  Mail::Client client;
  client.connect();
  client.send(m);
}
Exemplo n.º 3
0
void AuthService::sendLostPasswordMail(const std::string& address,
                                       const User& user,
                                       const std::string& token) const
{
    Mail::Message message;

    std::string url = createRedirectUrl(token);

    message.addRecipient(Mail::To, Mail::Mailbox(address));
    message.setSubject(WString::tr("Wt.Auth.lostpasswordmail.subject"));
    message.setBody(WString::tr("Wt.Auth.lostpasswordmail.body")
                    .arg(user.identity(Identity::LoginName))
                    .arg(token).arg(url));
    message.addHtmlBody(WString::tr("Wt.Auth.lostpasswordmail.htmlbody")
                        .arg(user.identity(Identity::LoginName))
                        .arg(token).arg(url));

    sendMail(message);
}
Exemplo n.º 4
0
void AuthService::sendConfirmMail(const std::string& address,
			       const User& user, const std::string& token) const
{
  Mail::Message message;

  WApplication *app = WApplication::instance();
  std::string url
    = app->makeAbsoluteUrl(app->bookmarkUrl(redirectInternalPath_)) + token ;

  message.addRecipient(Mail::To, Mail::Mailbox(address));
  message.setSubject(WString::tr("Wt.Auth.confirmmail.subject"));
  message.setBody(WString::tr("Wt.Auth.confirmmail.body")
		  .arg(user.identity(Identity::LoginName))
		  .arg(token).arg(url));
  message.addHtmlBody(WString::tr("Wt.Auth.confirmmail.htmlbody")
		      .arg(user.identity(Identity::LoginName))
		      .arg(token).arg(url));

  sendMail(message);
}
Exemplo n.º 5
0
void AuthService::sendMail(const Mail::Message& message) const
{
  Mail::Message m = message;

  if (m.from().empty()) {
    std::string senderName = "Wt Auth module";
    std::string senderAddress = "*****@*****.**";

    WApplication::readConfigurationProperty("auth-mail-sender-name",
					    senderName);
    WApplication::readConfigurationProperty("auth-mail-sender-address",
					    senderAddress);

    m.setFrom(Mail::Mailbox(senderAddress, WString::fromUTF8(senderName)));
  }

  m.write(std::cout);

  Mail::Client client;
  client.connect();
  client.send(m);
}
Exemplo n.º 6
0
void AuthService::sendMail(const Mail::Message& message) const
{
    Mail::Message m = message;

    if (m.from().empty()) {
        std::string senderName = "Wt Auth module";
        std::string senderAddress = "*****@*****.**";

        WApplication::readConfigurationProperty("auth-mail-sender-name",
                                                senderName);
        WApplication::readConfigurationProperty("auth-mail-sender-address",
                                                senderAddress);
#ifndef WT_TARGET_JAVA
        m.setFrom(Mail::Mailbox(senderAddress, WString::fromUTF8(senderName)));
#else
        m.setFrom(Mail::Mailbox(senderAddress, senderName));
#endif
    }

    m.write(std::cout);

    MailUtils::sendMail(m);
}