# CakePHP 4: Sending email from CLI can not create full URL Link

**URL:** <https://discourse.cakephp.org/t/cakephp-4-sending-email-from-cli-can-not-create-full-url-link/9709>\
**Category:** Uncategorized\
**Created:** [September 13, 2021, 6:12pm UTC](https://discourse.cakephp.org/t/cakephp-4-sending-email-from-cli-can-not-create-full-url-link/9709 "2021-09-13T18:12:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![general2000vn](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@general2000vn](https://discourse.cakephp.org/u/general2000vn)\
**Post date:** [September 13, 2021, 6:12pm UTC](https://discourse.cakephp.org/t/cakephp-4-sending-email-from-cli-can-not-create-full-url-link/9709/1 "2021-09-13T18:12:57Z")

</div>

Dear all,

I am sending emails from the same template and template variables, one of that is entity ID for creating View link.

- If using direct email sending from web app controller, the link has full URL.
- If using MailQueue which sends email via CLI command, the link does not have full URL, only controller, action, and parameter (entity ID).

Is it supposed to work that way?

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [September 14, 2021, 12:40am UTC](https://discourse.cakephp.org/t/cakephp-4-sending-email-from-cli-can-not-create-full-url-link/9709/2 "2021-09-14T00:40:40Z")

</div>

When running in the web app context, there are `$_SERVER` variables that Cake accesses to understand what domain you are on. When running from the CLI, these don’t exist. This is what the `App.fullBaseUrl` setting is for.

---

<div class="post-metadata">

**Author:** ![general2000vn](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@general2000vn](https://discourse.cakephp.org/u/general2000vn)\
**Post date:** [September 14, 2021, 2:55pm UTC](https://discourse.cakephp.org/t/cakephp-4-sending-email-from-cli-can-not-create-full-url-link/9709/3 "2021-09-14T14:55:37Z")

</div>

Thank you a lot, Zuluru

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [September 14, 2021, 4:58pm UTC](https://discourse.cakephp.org/t/cakephp-4-sending-email-from-cli-can-not-create-full-url-link/9709/5 "2021-09-14T16:58:00Z")

</div>

Note that `App.fullBaseUrl` can also be useful in web context, if you have multiple domains that your app runs under, but you want all emails that go out to reference a “primary” one regardless of which one the user is on when the email is triggered.
