Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send mail via the systems mail subsystem #2793

Closed
1 task done
stbc opened this issue Feb 17, 2023 · 11 comments
Closed
1 task done

Send mail via the systems mail subsystem #2793

stbc opened this issue Feb 17, 2023 · 11 comments
Labels
area:notifications Everything related to notifications feature-request Request for new features to be added

Comments

@stbc
Copy link

stbc commented Feb 17, 2023

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

Other

🔖 Feature description

It would be great if UK would not only send mail via smtp but optional via the mail subsystem on the system it is installed at.

✔️ Solution

Make use of system MTA to send mail to receiver

❓ Alternatives

No response

📝 Additional Context

No response

@stbc stbc added the feature-request Request for new features to be added label Feb 17, 2023
@CommanderStorm CommanderStorm added the area:notifications Everything related to notifications label Dec 6, 2023
@CommanderStorm CommanderStorm changed the title Send mail not only via SMTP Send mail via the systems mail subsystem Feb 1, 2024
@apio-sys
Copy link
Contributor

apio-sys commented Feb 1, 2024

I don't think this needs any work since it is already working (for me at least). I use exim4 on a Debian 12 as MTA. Hence all apps on the server can simply dump a mail() command to get stuff out.

netstat -tulp | grep "exim"
tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN      1555/exim4          
tcp6       0      0 ip6-localhost:smtp      [::]:*                  LISTEN      1555/exim4

Provided that your MTA actually works, i.e. test with something like:

echo "This is a test." | mail -s "Testing" mymail@domain.com

you can setup Uptime Kuma alert with "SMTP" to your local MTA like so:

Screenshot from 2024-02-01 14-08-31

and that's really all. To avoid confusion, maybe an entry could be added to say "Email (local)" without the unused fields from the SMTP setup to make this clearer. And/or in documentation. But the most important is that this actually works fine already so rest is nice2have/cosmetic and no showstopper.

@CommanderStorm
Copy link
Collaborator

Adding another notification type just with fewer fields is not something that, I think would be beneficial.

If you have ideas where helptexts/... would be benefitial, a Pull request would be appreciated

That our monitor/notification system is something that we are aware of, but at least I currently don't have the spare time to document this more than currently done in the frontend. Related issue louislam/uptime-kuma-wiki#71

I am going to close this issue as reolved, thanks @apio-sys

@stbc
Copy link
Author

stbc commented Feb 1, 2024

Thx a lot for pointing that out, @apio-sys
Never tried that somehow, as @CommanderStorm said, some help would be nice :)

@apio-sys
Copy link
Contributor

apio-sys commented Feb 8, 2024

Would be glad helping document SMTP sending via local MTA. But just to make sure before issuing a PR, would it be wanted as inline help text inside the monitor here: https://github.com/louislam/uptime-kuma/blob/master/server/notification-providers/smtp.js or in the help document here: https://github.com/louislam/uptime-kuma-wiki/blob/master/Notification-Methods.md ?

Kind regards,

Joris.

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Feb 8, 2024

Notification-Methods.md needs a much deeper overhaul and smtp.js is just the code for executing the heartbeat.

Adding helptexts to notification providers requires editing two different locations.

Foremost, text used in the $t(...)-translations should be translatable into other languages => adding said text 1:1 in src/lang/en.json into other languages is necessary to do so.

The UI you see in the following screenshot is located here https://github.com/louislam/uptime-kuma/blob/master/src/components/notifications/SMTP.vue
image

@apio-sys
Copy link
Contributor

apio-sys commented Feb 8, 2024

OK thanks for the clarifications. I need to setup a local dev env to test some stuff then. Would something like this:


        <div class="mb-3">
            <label for="hostname" class="form-label">{{ $t("Hostname") }}</label>
            <input id="hostname" v-model="$parent.notification.smtpHost" type="text" class="form-control" required placeholder="This might be &quot;localhost&quot; if sending via a local MTA">
        </div>

help or not? In that case it won't be translated of course but I can't see where I could otherwise add help text. Maybe using a hover over a question mark (icon or not) and then get a help bubble that can then also be translated?

Sorry for the noise, this is really not a big issue since it does work fine already but might help some people that wonder to work with local MTA vs remote SMTP (as I did myself when I started testing this great software a few months back).

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Feb 8, 2024

Would something like this

Great question, actually we currently have two ways of doing this:

  • the simple way is adding the following
    <div class="form-text">{{ $t("Either enter the hostname of the server you want to contact or localhost if you intend to use a locally configured mail transfer agent") }}</div>
  • using i18n-t components to embed more complex translations or translations requiring html tags (see discussion in Migrate all v-html translations to componentised translations #4135 why this is nessesary ^^)
    <i18n-t v-else-if="$parent.notification.webhookContentType == 'form-data'" tag="div" keypath="webhookFormDataDesc" class="form-text">
    <template #multipart>multipart/form-data"</template>
    <template #decodeFunction>
    <strong>json_decode($_POST['data'])</strong>
    </template>
    </i18n-t>

    <i18n-t tag="div" keypath="liquidIntroduction" class="form-text">
    <a href="https://liquidjs.com/" target="_blank">{{ $t("documentation") }}</a>
    </i18n-t>

I think for the usecase the second one fits better as likely a link to a piece of documentation/wikipedia what a MTA fits better

Sorry for the noise

This is NOT noise.
Noise is something like +1-ing an issue, creating hard/impossible to reproduce issues, ...

This is valid (encouraged!) discussion and has the upsides (among others) of f.ex.

  • knowing where other devs struggle => helping us improve the contribution guide and
  • not having to frustrate the heck out of you because merging the PR takes longer ^^

@apio-sys
Copy link
Contributor

apio-sys commented Feb 9, 2024

OK thanks. Once this is decided I would be glad to contribute to the Wiki article that would be referenced.

@CommanderStorm
Copy link
Collaborator

Once what is decided?

When I was saying that linking to docs/Wikipedia might be a good idea, I was thinking about the Windows/macOS/Linux docs1 about sending mails or the Wikipedia article explaining what an MTA is.
(=> i.e. the pointers you would find helpfull, if you were reading the UI for the first time ^^)
I don't think this needs a wiki article on our side (or does it??)

Footnotes

  1. have not looked if they exist

@apio-sys
Copy link
Contributor

apio-sys commented Feb 9, 2024

Well just to know we agree on to where to put that helptext and/or small wiki/doc. Either the simple way as per your point 1 and/or 2.a. or b. If we agree on where to put what, we can start working on it.

@CommanderStorm
Copy link
Collaborator

Yes, helptext below the hostname field is fine by me

apio-sys added a commit to apio-sys/uptime-kuma that referenced this issue Feb 11, 2024
apio-sys added a commit to apio-sys/uptime-kuma that referenced this issue Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:notifications Everything related to notifications feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

3 participants