A temporary solution for Gmail is to use a catchall mailbox and re-forward emails to specific recipient by using filters.
@cloonan, thank you for correction, but “catched” was correct. emails aren’t being “cached”
whoops, did not catch that before, but have caught it now
Hello, does, Cloudflare email forwarding support aliases?
Let’s say I setup forwarding of [email protected]. Will also [email protected] be forwarded?
Thank you.
Not currently.
Email Routing (beta) does not have advanced routing options. Characters such as
+
or.
, which perform special actions in email providers like Gmail and Outlook, are currently treated as normal characters on custom addresses. More flexible routing options are in our roadmap.
The documentation says:
Characters such as
+
or.
, which perform special actions in email providers like Gmail and Outlook, are currently treated as normal characters on custom addresses.
It’s even worse, unfortunately, as this is not what I’m seeing. Plus sign is not accepted inside a custom address. The error says: Allowed characters: 0-9 a-z _ .
– and I cannot save the new Email Route / rule.
I ran into this too. Luckily it seems like it is possible to add a custom address containing a +
sign via the API.
Has there been a statement from Cloudflare of whether this is on a roadmap, and if so, can they share any anticipated dates for when enhanced email routing (the ability to pass “+”) might be released?
So long and still no support for this?
So here is my worker code that is currently deployed to route plus symbols for 2 email addresses. There’s probably some room for optimizing this, but it’s functional.
export default {
async email(message, env, ctx) {
const pattern = [
/^user1\+.*\@domain.com$/,
'[email protected]',
/^user2\+.*\@domain.com$/,
'[email protected]'
];
const dest = message.headers.get('to');
if (pattern[0].test(dest)) {
await message.forward(pattern[1]);
} else if (pattern[2].test(dest)) {
await message.forward(pattern[3])
} else {
message.setReject('Address not valid')
}
}
}
My apologies for some of that code appearing outside the code block. I think I’m disallowed from editing my posts since I’m such a new user.
export default {
async email(message, env, ctx) {
const pattern = [
/^user1\+.*\@domain.com$/,
'[email protected]',
/^user2\+.*\@domain.com$/,
'[email protected]'
];
const dest = message.headers.get('to');
if (pattern[0].test(dest)) {
await message.forward(pattern[1]);
} else if (pattern[2].test(dest)) {
await message.forward(pattern[3])
} else {
message.setReject('Address not valid')
}
}
}
+1 for supporting plus addressing. I use this feature extensively.
Thank you @computerprep that’s exactly what I was looking for and I’ve managed to recreate the plus addressing of gmail by attaching this worker to my domain catchall.
+1 for plus addressing. Plus addressing is core for us. Cloudflare team - any update on where this is on the roadmap?
+1 for RFC 5233 support.
Any chance of implementing plus-addressing?
It is implemented by many email providers, and would be very usefull.
This is where [email protected] is caught by [email protected].
@jhedfors - I would suggest you upvote the already existing feature request we have here.
At the moment, you can run an Email Worker (set up as a Catch all), that will be distributing your messages accordingly (to verified addresses) based on various patterns.
Thank you! I attempted to follow @computerprep’s code example (all addresses are verified), and while it appears to pass the “Trigger email event” test, it processes the else statement (in my case - a catch-all email account) when running it for real. Here is my implementation:
export default {
async email(message, env, ctx) {
const pattern = [
/^j\+.*\@mydomain.net$/,
/^k\+.*\@mydomain.net$/,
];
const dest = message.headers.get('to');
if (pattern[0].test(dest)) {
await message.forward('[email protected]');
} else if (pattern[1].test(dest)) {
await message.forward('[email protected]')
} else {
await message.forward("[email protected]");
}
}
}
Any suggestions?
@dr17 Is this working for you?
Thanks to @DarkDeviL and @computerprep . In case anyone is interested, here is my code simplified (subdomain and sub-addressing):
If-Else version:
export default {
async email(message, env, ctx) {
if (/^.*\@user1\.mydomain\.net.*$/.test(message.to) || /^user1\+.*\@.*$/.test(message.to)) {
await message.forward("[email protected]");
} else if (/^.*\@user2\.mydomain\.net.*$/.test(message.to) || /^user2\+.*\@.*$/.test(message.to)) {
await message.forward("[email protected]")
} else if (/^.*\@user1and2\.mydomain\.net.*$/.test(message.to) || /^user1and2\+.*\@.*$/.test(message.to)) {
await message.forward("[email protected]")
await message.forward("user2gmail.com")
} else {
await message.forward("[email protected]");
}
}
}
Switch-case version:
export default {
async email(message, env, ctx) {
switch (true){
case (/^(.*\@user1\..*|user1\+.*\@.*)$/.test(message.to)):
await message.forward("[email protected]");
break;
case (/^(.*\@user2\..*|user2\+.*\@.*)$/.test(message.to)):
await message.forward("[email protected]");
break;
case (/^(.*\@user1and2\..*|user1and2\+.*\@.*)$/.test(message.to)):
await message.forward("[email protected]");
await message.forward("[email protected]");
break;
default:
await message.forward("[email protected]");
}
}
}
When?
Couple more months passed… any chance this is being worked on at all?