Closed wychwitch closed 2 years ago
I haven't used Sendgrid before, so I'm not completely aware what options they offer. If they offer SMTP login using a domain or IP and login details, that can easily be configured straight in php.ini. If it only supports some kind of JSON or XML API, then I would guess applications would specifically need to implement support for Sendgrid. Could you maybe elaborate on that a bit? I can then see what solutions are possible.
Thanks for getting back to me so soon! I wasn't expecting it hahaha
Thank you for prompting me to research this deeper! After looking at their documentation it looks as though you can sign in using SMTP login as outlined here. There's also an alternate PHP example here,.
So, if I understand correctly, I can just supply php.ini with sendgrid's details as per their documentation and that should work? In that case that's much easier than I was expecting hahaha.
I'll also post the php example if that is relevant here if you're interested!
Seems like you can indeed chose between using SMTP credentials or implementing their API into the application. In case of Tabby, I didn't really want to figure out all the different APIs for the more popular email services (Google, Microsoft, Sendgrid, Mailgun, Mailjet, Twilio, ...), especially since I don't want to encourage the use of external and/or closed source solutions but try to adhere to the selfhosted concept of https://github.com/awesome-selfhosted/awesome-selfhosted/ .
Luckily, it seems Sindgrid offers SMTP credentials you can configure in php.ini for all your PHP applications, which is much cleaner and simpler, and very similar to the setup I use (but I use a local email server).
Hopefully you can get things working that way. If you get it set up perfectly, please let me know (and feel free to close the issue at that point). I might clarify further in a next release that you can configure SMTP credentials easily through php.ini, since I don't mention that in the message you quoted.
Great! I'll try to get it set up soon and let you know if it works!
Also if you don't mind, could you share what kind of email server you use? I may try my hand at running my own eventually and only just started looking into different software and docker images.
Oh I think I have it almost finished, but I ran into the following error when actually trying to send the email out:
[20-Sep-2021 06:25:11] WARNING: [pool www] child 72 said into stderr: "sh: 1: /usr/sbin/sendmail: not found"
I realized I hadn't installed sendmail, so I ran apt-get to install it, but it's still running into the same error. Is there some value in pbp.ini that I'm missing that needs to be set?
Okay some updates
My issues with sendmail in the above comments was because I was running tabby in docker as per the instructions found here, since I prefer to run things in docker where possible. However sendmail wasn't included in this configuration, so I had to connect to the docker container and running apt-get install sendmail
which has almost got it working.
Now I'm running into this error:
[SYSLOG] sendmail[1185]: 18KJbEp4001185: to=user@foo.bar, ctladdr=application (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30465, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
I modified the docker launch command like so:
sudo docker run --link some-weird-mariadb -v /tmp/tabby2/:/app -p 8070:80 -p 587:587 webdevops/php-nginx
And no dice. As this is im sure far beyond the intended setup, I will abandon using docker and try with a standard nginx host configuration and update once i get something working.
OKAY FINALLY GOT IT WORKING WITH SENDGRID
I followed these instructions using the sendgrid credentials. Just in case the guide ever falls or someone needs exact instructions here's how I did it
Seems you have been busy! Sorry for the late reply, I had a crazy day at work and some stuff I still had to do around the house.
Hmmm, if I understand things correctly, you are now using sendmail with the sendgrid SMTP instead of using the sendgrid SMTP directly in PHP. That's also possible, but a lot more complicated I think. But I'm glad you got it working! :D
To answer your earlier question: I run postfix with a MySQL backend to define mailboxes and aliases, I use dovecot as the LDA (so I can use sieve and managesieve) and for IMAP, and use amavis with spamassassin for anti-spam. It's not a complicated setup, but it can be challenging to start to understand the components.
No problem!! and yeah, I switched to SMTP + sendmail because apparently php on linux systems doesn't support SMTP?? at least without installing and configuring something else. This way ended up being easier.
I saw postfix come up repeatedly on my searches! I'll def look into it sometime, maybe even try a mail server docker out now that I know how to get sendgrid working with SMTP credentials. It sounds challenging but thanks for telling me anyways! It'll be good to have something to launch off of!
I was trying out tabby today and saw this text on the installation screen
With a link to php documentation here.
My question is, are there any examples of ways to adapt php.ini for non standard email set ups? I currently don't have a working sendmail on my server, and usually use sendgrid for other applications that have the built in support for it. Is using sendgrid here even possible? Or is sendmail the only way to use this application?
Many thanks in advance.