View Issue Details

IDProjectCategoryView StatusLast Update
0001632Anope Stable (2.0.x series)Generalpublic2015-03-12 14:16
Reporterptseng Assigned ToAdam  
Status resolvedResolutionfixed 
Summary0001632: Email change confirmation lists old email rather than new.
DescriptionThe default data/example.conf has emailchange_message with "You have requested to change your email address to %e".

Then in SendConfirmMail in modules/commands/ns_set.cpp, we replace %e with the account's current email.

This results in a message being sent to the user claiming "You have requested to change your email address to (OLD EMAIL)", when instead that should be the new email. (The email is, however, correctly sent to the new email)

One possible fix is to replace %e with the new_email var instead. However, some users of Anope may have already assumed %e is the old email and written their emailchange_message accordingly. I think for compatibility it would be wiser to leave %e as is, and introduce a new variable, perhaps named %E, that contains the new email address.

I attached a patch (exported with `git format-patch`, so should be ready to `git am`) to that effect, or open to discussion on the matter. I can submit a PR on github too if that is preferred.
Steps To Reproduce/ns set email then check your email.
TagsNo tags attached.



2015-03-12 14:16

administrator   ~0006719

Applied in bf727285bcf7c7c95c2b2b43faa3d1fa13bad6fb, thanks.


2015-02-01 16:14

reporter   ~0006694

I believe the change in behavior was introduced in 1a3d9a016d3adc49788bbff73aac9b3b5ea85b17


2015-02-01 15:52


0001-SendConfirmMail-Replace-E-with-new-email.patch (2,124 bytes)   
From 999a4236f3879ad437fb927c31ad757c1f427a38 Mon Sep 17 00:00:00 2001
From: Peter Tseng <>
Date: Sun, 1 Feb 2015 13:43:42 +0000
Subject: [PATCH] SendConfirmMail: Replace %E with new email

The old mailer message said the user is changing email "to %e", which is
changing TO the OLD email. But instead, the user is actually changing
the email to the new email.

We could change %e to be the new email, but maybe some users of Anope
have already configured their messages to assume %e is the old email. So
instead, add a new %E that is replaced with the new email.
 data/example.conf           | 2 +-
 modules/commands/ns_set.cpp | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/data/example.conf b/data/example.conf
index 0db803f..a85e4df 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -1018,7 +1018,7 @@ mail
 	emailchange_subject = "Email confirmation"
 	emailchange_message = "Hi,
-			You have requested to change your email address to %e.
+			You have requested to change your email address from %e to %E.
 			Please type \" /msg NickServ CONFIRM %c \" to confirm this change.
 			If you don't know why this mail was sent to you, please ignore it silently.
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 03ebae8..fdf2a5e 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -414,10 +414,12 @@ class CommandNSSetEmail : public Command
 			message = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_message");
 		subject = subject.replace_all_cs("%e", u->Account()->email);
+		subject = subject.replace_all_cs("%E", new_email);
 		subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
 		subject = subject.replace_all_cs("%c", code);
 		message = message.replace_all_cs("%e", u->Account()->email);
+		message = message.replace_all_cs("%E", new_email);
 		message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
 		message = message.replace_all_cs("%c", code);

Issue History

Date Modified Username Field Change
2015-02-01 15:52 ptseng New Issue
2015-02-01 15:52 ptseng File Added: 0001-SendConfirmMail-Replace-E-with-new-email.patch
2015-02-01 16:14 ptseng Note Added: 0006694
2015-03-12 14:16 Adam Note Added: 0006719
2015-03-12 14:16 Adam Status new => resolved
2015-03-12 14:16 Adam Resolution open => fixed
2015-03-12 14:16 Adam Assigned To => Adam