Locally a Rail app works well, but on a VPS server when I try to send an email with all the correct settings by the means of the Rails app, I get this error in the logs:
sh: 1: /usr/sbin/sendmail: not found
How to fix it?
You need to install the sendmail package on your VPS as well as your local machine. Assuming you use some form of Debian linux, you want to run:
sudo apt-get install sendmail
on the VPS.
You need to install a Mail Transport Agent (MTA).
First, let's install postfix, which provides a /usr/bin/sendmail:
apt-get update
apt-get install postfix
A configuration screen will pop up, where you need to enter some configuration values. This really depends on your setup. The standard installation is "Internet site", where mail will be sent directly from your server. You can also configure it to relay mail through an external mailserver, which may be preferable if you don't want to deal with SPF, TLS, reverse DNS, etc. But the specifics of the configuration is outside the scope of this question (just Google it, or post a new question if you get stuck).
Related
I want to use DO as my DNS Server. For emails I use 1and1 and I setup the Nameserver Configuration in the Domain control panel to use the DO Nameserver.
In DO I added an MX entry:
But is this the correct way? If I use one of my email I set up, do I need to configure it differently? If I send an email, nothing is being received in my inbox. For example the mail test#isarfaktor.de
How do I need to configure DO to handle emails with 1and1 properly?
Thank you
You didn't mentioned the Operating system of your Virtual Private Server.
First, you have to setup your server using postfix if you follow my method.
Approx 29% of public mail servers on the internet run very popular opensource mail transfer agent Postfix.Its helps to route and deliver email on a Linux system.
Make sure you have set up the domain with the ip already.
Now install post fix
sudo apt-get update
sudo apt-get install postfix
it will ask for domain name put your domain like this - farukkadir.com without any prefix like www.
now you have to edit postfix config by put this command
sudo nano /etc/postfix/main.cf
find myhostname = something.com and edit with your domain
If you would like to configuring mail to be forwarded to other domains or wish to deliver to addresses that don't map 1-to-1 with system accounts, you can remove the alias_maps parameter and replace it with virtual_alias_maps. We would then need to change the location of the hash to /etc/postfix/virtual:
virtual_alias_maps = hash:/etc/postfix/virtual
and to get a webui install open source squirrel mail -
If you still need help just comment here
Folks....I posted this question on the Raspberry Pi forum and got no replies. Hopefully you can help me?
I'm using a Raspberry Pi B+ running Raspbian OS.
I have set up e-mail using this link: http://rpi.tnet.com/project/faqs/smtp
sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo apt-get install mpack
and then configured it like this
#
# Config file for sSMTP sendmail
#
root=me#mydomain.com
# The full hostname
hostname=MyRasPi
AuthUser=me#gmail.com
AuthPass=myGmailpw
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
#AuthUser=me#mydomain.com
#AuthPass=mypw
#mailhub=mail.mydomain.com:465
The above setup works and the test line
echo "sample text" | mail -s "Subject" myid#hotmail.com
works with the note arriving at my Hotmail account.
But, in fact, I do not want to use Google's Gmail system. I have my own domain and mail server.
I modified the above ssmtp.conf to use the hash-ed out lines to replace the Gmail lines. When I use Outlook I have to configure my outgoing (SMTP) server "requires authentication" and needs to use SSL and port 465. When I now try the above mail command it just hangs and I have to control-C to get back to the command line prompt.
What am I doing wrong? Thanks...RDK
I know I am late to the party, but this is this reason this didn't work for you:
Port 465 doesn't use STARTTLS (which is basically first connecting with a plaintext connection and then switching to TLS), but directly establishes a SSL/TLS connection.
So you should probably use the following options:
UseTLS=YES
UseSTARTTLS=NO
However, this is still completely insecure:
I wanted to use ssmtp today too, but noticed that it does NOT verify the SSL/TLS certificate of the remote server on the current debian & ubuntu releases and also does NOT verify the hostname of the certificate. This is a major issue, as this effectively renders the encryption useless and your password is being transmitted alike to being plaintext and anyone can sniff it. This has also been reported in a debian bug, but there has not been any progress for years: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662960
The ssmtp version in the Redhat packages has been patched to atleast verify the certificate, but the hostname is still NOT being verified and the encryption is therefore as insecure as on debian/ubuntu. There is a bug for this, but there is also no progress for years: https://bugzilla.redhat.com/show_bug.cgi?id=864894
So, if you care about the security of the email account you use for your servers outgoing emails, do NOT use ssmtp.
ssmtp has had no active development since atleast 2009: https://anonscm.debian.org/gitweb/?p=ssmtp/ssmtp.git
After researching other solutions, like nullmailer and msmtp, I decided to settle on using postfix, as it is so much easier to set up and can easily be configured for just outgoing mails, and it's easy to use just the features you need without it acting as a full MTA.
Here is an example with the most important postfix settings for this: https://unix.stackexchange.com/questions/116805/how-to-install-postfix-for-sending-mails-to-admin-only/118101#118101
try to use postfix to configure gmail forward. Somehow ssmtp is not compatible with gmail anymore, even the account has enabled authentication by less secure application.
see the tutorial below:
https://www.howtoforge.com/tutorial/configure-postfix-to-use-gmail-as-a-mail-relay/
http://www.algissalys.com/network-security/send-email-from-raspberry-pi-command-line
I am looking for a single line email notification solution for linux, but one that would not assume that the machine mail agent was already configured properly.
I want to specify the SMTP server from the command.
Preferably, the solution should run on Debian without having to install new tools.
I have had Sendmail set up in one of my CentOS servers, and I have email marketing software running on it.
I configured Sendmail last time to make sure everything worked and everything was fine. Last week my hosting company changed my IP address and now everything is fallen apart.
I tried to send an email with mail() and it is not getting delivered. Everything is not getting delivered and sitting on the /var/spool/mail/root.
The error I am getting is "mail loops back to me MX problem".
In my sendmail configuration I have now changed:
LOCAL_DOMAIN to be my domain
and also added my domain to hosts
I don't know what else to do. Sorry I am a novice in CentOS and SSH so if you can put the commands than just saying what to do, that will be great too.
I fixed this yesterday by uninstalling and reinstalling sendmail and just letting it run by default.
Something like
rpm -e sendmail
and then
yum install sendmail
yum install sendmail-cf
etc/init.d/sendmail start
I regularly send files in Gmail to exchange files between different computers. It is cumbersome. I want quickly to send my files, such as error logs. I found a promising article [1] about Mutt, but it apparently is not what I want:
Please note that mutt is a pure MUA
and cannot send e-mail without proper
email server .
I want no email server, since I cannot install it to my clients' computers. I don't need to know the sender. I want quickly to send many error logs to my Gmail. I am looking something like:
mutt -s "Many error logs" -a
./log1 -a ./log2 -a ./log3 mygmail#gmail.com
I would really love to do the job in terminal. It is too time-consuming to bulk-send files in Gmail. How can I quickly send a great amount of files?
[1] http://www.cyberciti.biz/tips/sending-mail-with-attachment.html
Mutt can be configured to use a different MTA than the default sendmail. You could install SSMTP (described here and available for download here) or ESMTP and configure it to send directly to Gmail's web server, then configure Mutt to use SSMTP or ESMTP. This is nicely described in this Ubuntu tutorial. If installing systemwide binaries isn't an option, you ought to be able to install SSMTP or ESMTP to a local folder.
If you prefer scripting, mimesend, which is one of the example programs in Perl's MIME-tools package, does the same thing as your mutt command and could be hacked to connect to Gmail's web server.
Why are you using email for this? Other options:
FTP/SCP (run a server yourself, or purchase a hosted service)
Internet storage service like Dropbox.
assuming that you don't want to use ftp/scp as suggested above, here is how i solved a similar problem ... emailing logs from a client:
i created a cgi script on my server that had the ability to mail things to myself. a sort of email proxy webservice.
the client posted the files it needed to send (along with authentication, obviously) to that cgi script.
that way the client only needs to talk to my server instead of talking to a mail server.
perhaps this helps.
-don