Questo articolo può essere applicato a differenti scenari: una installazione Linux minimale, un’istanza virtuale o contenitore che non include un MTA, incompatibilità tra differenti interpreti, un desolante messaggio nella riga di comando da console tipo
sh: 1: /usr/sbin/sendmail: not found
In aggiunta, si può avere la necessità (anche dal punto di vista della comodità o per via di esigenze legate a razionalizzazione delle risorse) di voler utilizzare un servizio esterno all’host che si occupi dell’inoltro dei messaggi di posta elettronica, sfruttando un servizio SMTP con un profilo esistente (fornito anche all’esterno della sede locale, come per es. Google Apps for Work od il comune Gmail), escludendo l’opzione di installare un servizio puro superfluo o inutile su una macchina non desinata a ricevere posta.
Sintesi: il software in questione deve occuparsi di smistare messaggi di posta elettronica, rappresentando il tratto di unione tra un interpretesendmail-compatibile ed un client SMTP. Esiste di già, ed è MSMTP.
MSMTP: requisiti ed installazione
Il progetto MSMTP manutenuto da Martin Lambers è rilasciato come codice libero in licenza GPLv3: i requisiti sono ristretti ad un compilatore e le funzioni per socket tipo Berkeley. Disponibile sui repository delle maggiori distribuzioni Linux, si può comunemente lanciare
apt-get install msmtp
per l’installazione in Debian od Ubuntu, mentre per le altre in base yum tipo RHEL / CentOS
yum install msmtp
Su Apple MacOS 10, MSMTP è disponibile con la formula homebrew
brew install msmtp
La configurazione si basa su file di testo semplici, con i percorsi predefiniti per sistema su /etc/msmtprc e ~/.msmtprc per le configurazione dei singoli utenti. Sul sito di riferimento è presente la documentazione completa (in inglese) ed un file di esempio. Davvero lineare.
Integrazione con PHP ed uso di account Gmail
Come riportato poco prima, MSMTP è sostituibile al comando sendmail, pertanto ci si può disporre a questo tipo di configurazione creando un file in /etc/msmtprc con la configurazione di un account SMTP esistente; il software supporta il TLS, quindi l’esempio Gmail è anche un buon esercizio per verificare questa opzione.
Contenuto del file /etc/msmtprc :
# Esempio msmtprc per Gmail # 2014 Alessio Felicioni # fonte: http://www.alessiofelicioni.it/msmtp-gmail-funzione-mail-php/ # valori predefiniti defaults tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile /var/log/msmtp.log # configurazione account account default host smtp.gmail.com port 587 auth on from utente@gmail.com user utente@gmail.com password La(TUA)Password_va_qui
Importante garantire che il file sia leggibile dall’utente che esegue il php via processo server (es. apache, www-data o equivalente): vale a dirsi
chown www-data /etc/msmtprc chmod 600 /etc/msmtprc
Quindi il valore di sendmail_path in php.ini potrebbe essere sostituito con la seguente sintassi
sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc -t"
MSMTP supporta anche la configurazione di account multipli anche sullo stesso file: il parametro che controlla questa opzione è -a con il significato che se invocato con valori differenti, lo smistamento avverrà attraverso profili (ed eventualmente tratte/server SMTP) differenti.
La sezione di documentazione del progetto all’indirizzo http://msmtp.sourceforge.net/documentation.html è il punto di riferimento per utilizzare al meglio il programma e ricca di esempi.
Hi I am so excited I found your blog page, I
really found you by error, while I was searching on Askjeeve
for something else, Anyhow I am here now and would just like to say many thanks for a tremendous post and
a all round entertaining blog (I also love the theme/design),
I don’t have time to look over it all at the moment but I have book-marked it and also included your RSS feeds,
so when I have time I will be back to read a great deal more, Please do keep
up the excellent job.
Excellent post. I was checking continuously this blog and I am
inspired! Extremely helpful information specifically the closing phase :
) I handle such information a lot. I was looking for this particular information for a very long
time. Thank you and best of luck.
obviously like your web site but you have to take a look at the
spelling on quite a few of your posts. Many of them are rife
with spelling problems and I find it very troublesome to
inform the truth then again I will certainly come back again.
wonderful publish, very informative. I ponder why one other experts on this sector
don’t realize this. You must continue your writing.
I am confident, you’ve a massive readers’ base already!
Thank you for the good writeup. It in truth was a amusement account it.
Glance complicated to far delivered agreeable from you!
However, how can we communicate?
These are typically genuinely great ideas in about blogging.
You may have touched some nice things here. In any manner keep up wrinting.
Attractive section of content. I simply stumbled upon your blog and in accession capital to say that I
acquire actually enjoyed account your weblog posts.
Anyway I’ll be subscribing on your augment and even I success you get right of entry to constantly rapidly.
Hi it’s me, I am also visiting this web site daily,
this site is truly fastidious and the people are truly
sharing pleasant thoughts.
Howdy could you mind letting me know which hosting company you’re utilizing?
I’ve loaded your site in 3 different internet browsers and
I have to admit this blog loads a good deal quicker then most.
Is it possible to recommend an excellent hosting provider with a fair price?
Thank you, I appreciate it!
Using Servage at the moment: if interested in ordering use cust37637 coupon code to get extra resources for free.
Excellent post however , I was wondering if you could write a litte more on this topic?
I’d be very grateful if you could elaborate a little bit more.
Appreciate it!
It’s impressive that you will be getting ideas from this post along with from the
discussion made at this point.
Hi there, I like reading all of your article. I wanted to write down a little comment to support you.
great points altogether, you simply won a brand new reader.
What could you recommend about your post that you just made a few days ago?
Any positive?
Keep this going please, great job!
This is my first time visit at here and i am truly happy to read all at alone place.
Greate pieces. Keep writing such kind of info on your page.
Im really impressed by your blog.
Hi there, You’ve done an excellent job. I will certainly digg it and in my view suggest to my friends.
I am sure they’ll be benefited from this site.
I do believe the admin of the website is actually making an effort in favor of his site, as here every material
is quality based stuff.
I feel that is one of the most significant info
for me. And i’m satisfied studying your article. However want to observation on few general things, The website style is perfect, the articles is
really nice : D. Excellent process, cheers
I am genuinely grateful on the owner on this site having shared this great
piece of writing at here.
Thanks for that marvelous posting! I definitely enjoyed reading it, you might be
a fantastic author. I am going to be sure you bookmark your blog and definately will often return down the line.
I would like to encourage continue your great work, use a nice morning!
Hmm is anyone else encountering problems with the images on this blog loading?
I’m trying to figure out if its a problem on my end or if it’s the blog.
Any feed-back would be greatly appreciated.
I simply want to say I am just beginner to blogs and truly loved this web blog. Very likely I’m going to bookmark your blog post . You really come with really good well written articles. Thanks a lot for revealing your web site.
Spot up with this write-up, I absolutely believe this phenomenal site needs significantly more attention. I’ll probably be returning to read more, thanks for the
advice!
Simply want to say your article is as amazing. The clarity to your publish is simply
nice and that i can assume you are a professional on this
subject. Fine along with your permission allow me to grab
your RSS feed to stay up to date with imminent post.
Thank you a million and please carry on the rewarding work.
Hi there to all, how is the whole thing, I think every one is getting more from this website,
and your views are good designed for new visitors.
Wow that was unusual. I just wrote an really long comment but after
I clicked submit my comment didn’t appear. Grrrr…
well I’m not writing all that over again. Anyways,
just wanted to say wonderful blog!
Hi! I could have sworn I’ve visited this site before but after taking
a look at a lot of the articles I realized it’s new to me.
Regardless, I’m certainly pleased I came across it and
I’ll be book-marking it and checking back frequently!
Nice answer back in return of this matter with genuine arguments and
telling the whole thing concerning that.
each time i used to read smaller articles that as well
clear their motive, and that is also happening with this paragraph which I am reading at this time.
Thanks for ones marvelous posting! I truly enjoyed reading it, you will be a fantastic author.
I will make sure to bookmark your site and definately will eventually come back in the foreseeable
future. I would like to encourage one to continue your great writing, use a nice afternoon!
Cіao un mio amіco mi ha girato l’indirizzo di questo bloog e sono ѵenuta a vedere сom’è.
Mi ρiace enormemente. Meseso tra i preferiti. Bellissimo blog e grafica spettaсoloso!
Admiring the hard work you put into your site and detailed information you offer.
It’s awesome to come across a blog every once in a while that isn’t the same outdated rehashed information. Great read!
I’ve bookmarked your site and I’m including your RSS feeds to my Google
account.
Thankfulness to my father who stated to me on the topic of this website,
this webpage is really remarkable.
I like the helpful info you provide to your articles. I will bookmark your blog and test again right here regularly.
I am fairly certain I will be informed plenty of new stuff
proper right here! Good luck for the following!
Thankfulness to my father who informed me about this blog, this website is
in fact remarkable.
Thanks for finally writing about >MSMTP: usare GMail con la funzione mail() in PHP – Alessio Felicioni <Liked it!
Way cool! Some very valid points! I appreciate you writing this post and
the rest of the site is also very good.
What’s up i am kavin, its my first occasion to commenting anyplace, when i read this paragraph i thought i could
also create comment due to this brilliant paragraph.
It’s remarkable to pay a quick visit this web site and reading the views
of all friends concerning this piece of writing, while I am also keen of getting experience.
You should take part in a contest for one of the greatest websites on the internet.
I most certainly will highly recommend this blog!
Wow, awesome weblog format! How lengthy have you been blogging for?
you make running a blog glance easy. The total look of your web site is wonderful,
as well as the content!
Great blog here! Also your website loads up very fast!
What web host are you using? Can I get your affiliate link to your host?
I wish my website loaded up as fast as yours lol
This is really interesting, You are a very skilled blogger.
I have joined your feed and look forward to seeking more of your
wonderful post. Also, I’ve shared your website in my social networks!
Hi! I could have sworn I’ve been to this blog before but after
reading through some of the post I realized it’s new
to me. Anyways, I’m definitely delighted I found it and I’ll be bookmarking
and checking back often!
Awesome blog. I enjoyed reading it! Thank you!
save for the early-bird gang of media types clustered in the press box and a scattering of event staff down on the field.
Schaub at 33 would be defying history to bounce back from last season’s benching.
saying he doesn’t expect it to be anything serious.
Sanchez started in all but two games for Gang Green in his first four seasons.
saying: ;That’s what the game is all about: respect.
gible to face ArsenalGranit Xhaka returns to the starting eleven for the Premier League clash, but Debuchy has brought back in from the cold at the Emirates, having last played in the North London derby last November.
The warning read:?“Cold northerly winds will bring frequent snow showers through Thursday and into Friday.
scampering for 120 yards and a touchdown over his past four games.
Thanks for sharing, this is a fantastic blog.Really thank you! Awesome.
I have read so many posts on the topic of the blogger lovers however this post is actually
a good piece of writing, keep it up.
Loving the information on this site, you have done great job on the content.
Good day I am so thrilled I found your web site, I really found you by mistake, while
I was searching on Bing for something else, Regardless I
am here now and would just like to say kudos for a remarkable post and a all round thrilling blog (I
also love the theme/design), I don’t have time to
browse it all at the moment but I have saved it and also included your
RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up
the awesome job.
It’s difficult to find experienced people about this
topic, however, you seem like you know what you’re talking about!
Thanks
I’m gone to convey my little brother, that he should also pay a visit this website on regular basis to take updated
from hottest information.
I blog quite often and I seriously thank you for your content.
This article has really peaked my interest. I’m going to
book mark your blog and keep checking for new information about once a week.
I subscribed to your RSS feed as well.
My family every time say that I am killing my time
here at web, however I know I am getting knowledge daily by reading thes pleasant
articles or reviews.
Hi there to every one, since I am really eager of reading this blog’s post to be updated daily.
It includes fastidious information.
Howdy would you mind letting me know which webhost you’re working with?
I’ve loaded your blog in 3 completely different web browsers and I must say this blog loads a lot faster then most.
Can you recommend a good hosting provider at a honest price?
Cheers, I appreciate it!
Wow that was odd. I just wrote an extremely long comment
but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Anyways, just wanted to say excellent blog!
Hi there i am kavin, its my first time to commenting anywhere, when i
read this paragraph i thought i could also create comment due to this brilliant post.
I loved your post but I am really not understanding the theme. Is it a default theme or something? Take care and Continue posting!
I go to see each day some blogs and websites to read articles
or reviews, but this blog gives quality based writing.
Good post. I learn something new and challenging on blogs I
stumbleupon everyday. It will always be useful to read content
from other writers and practice something from their websites.