respond with mailto:firstname.lastname@example.org
- Member | 8
To hide mail addresses from scanning bots, I'd like to answer a specific http request with a redirection to an mailto: Location which lets the mail client pop up. But avoids the "mailto:"within the source-code of the page.
Usually this is simply done in a separate file e.g.
After compile the mail address,
header('Location: mailto:email@example.com'); for
exit(1) the script to avoid further output. Invalid
request will be answered by 404
how to implement a similar behavior within a presenter action?
And is a presenter the correct approach?
Thank you in advance!
- Marek Bartoš
- Nette Blogger | 970
$this->sendResponse(new RedirectResponse(/* ... */))
return new \Nette\Application\Responses\RedirectResponse('mailto:firstname.lastname@example.org');
Both are equal and work as a replacement for
Presenter is indeed the right place for page-specific http request handling, you are going the right way :)
Last edited by Marek Bartoš (2022-01-24 01:56)