auth example: server's email 'reply to' / 'from' field configuration
Added by Robi K about 11 years ago
Hello,
I'm a beginner with Wt and I like it a lot!
I have a customized auth example up and running using https and postfix but I can't figure out, how to change the email 'reply to' field which still shows 'noreply-auth@www.webtoolkit.eu'. Can someone give me a hint how this is configured? I didn't find it in the 'auth_strings.xml'.
cheers, rob
Replies (3)
RE: auth example: server's email 'reply to' / 'from' field configuration - Added by Robi K about 11 years ago
Nevermind, I found out that it's default setting comes from Wt::Auth::AuthService::sendMail
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 = "noreply-auth@www.webtoolkit.eu";
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);
}
It seems that there are several possibilities:
- specialize AuthService::sendMail
- custumizing Mail::Message
- setting the configuration properties 'auth-mail-sender-name' and 'auth-mail-sender-address'
I'll investigate further this evening.
RE: auth example: server's email 'reply to' / 'from' field configuration - Added by Koen Deforche about 11 years ago
Hey,
Obviously, setting the configuration properties is the simple solution, if that's all you need?
Regards,
koen
RE: auth example: server's email 'reply to' / 'from' field configuration - Added by Robi K about 11 years ago
Hi Koen,
Thank you! I did't realize it was that straight forward i.e. the properties can be simply set in the wt_config.xml. I'm still a beginner :)
greetings, rob