amazon-ec2 -> php mail()? - amazon-ec2

I am running a PHP website on an amazon EC2 Ubuntu server.
I would like to use PHP's mail() function for sending a few admin notification emails per day.
First the mail() function didn't work.
Then I did:
sudo apt-get install postfix
Now it works but I wonder if this is safe? Can my server be used for spam now?
Edit:
No I don't wan't to send spam. :) I don't really know what postfix/sendmail does on the server. My fear was that it installs some open SMTP service which is open to spammers if I don't secure it somehow but I guess this isn't true?

Related

XAMPP SMTP Blocked by Firewall or wrong settings

(PS using xampp)
Apparently my machine won't send out emails using the Mailing APIs(PHPmailer,Swift) and even PHP's own mail() function. But whenever I run my emailing script on another machine, it works with no errors.
Tried it on other machines such as my univ's pcs, friend's pc and my other laptop.
Fatal error: Uncaught Swift_TransportException: Connection could not be
established with host smtp.gmail.com
Tried everything,but still to no avail on my current machine.
What this tells you is that there is nothing wrong with your script, but that your hosting provider blocks outbound SMTP. This is a very common problem, and it's covered extensively in the PHPMailer troubleshooting guide.
How you actually fix it depends on your ISP - it may be that you just need to ask them to unblock it (Scaleway), or that you need to send via their servers (GoDaddy), or in the worst case, that you need to find a new hosting provider...

Can we use roundcube, thunderbird or any webmail in our xampp/wamp server?

I have a web application developed in PHP and all users can access it via local network(xampp), now the users want to access their gmail,yahoo or any emails via localhost(xampp), I want something like MS-outlook to work in my xampp.
is there any solution ?
the propper way to do this is if you use email server at localhost better already install apache2 in your own device
also using postfix and dovecot will be very helpfull here some link
about webmail configuration in google cloud instance
https://medium.com/geekculture/how-to-host-a-personal-email-server-on-google-cloud-for-free-part-i-8124d65d1d25
perhaps that concept will help you to develop your own webmail in Local Area Network

Joomla can't send SMTP email on GCE

I have a weird problem.
I have install Centos7 on GCE.
I know that Google blocked port 25, 465, 587 for SMTP. To make thing simple, I've decided to use Mailgun for MTA.
Mailgun is superbly easy. Everything works fine on localhost. I can send email from Joomla instance.
However, when i I moved to GCE, Joomla (3.5.1) not able to send email. It keeps telling me SMTP connect() failed.
I also tried using another SMTP agent like Gmail, GApps etc. It works on localhost but not GCE.
Is there setting that i missed?

Send mail from a BASH Script and how to configure mail servers for Ubuntu

I have multiple (read 10s) MySQL slaves running in a LAN. Obviously, I cannot monitor them automatically from an external systems.
So, I thought of setting up local BASH scripts that will send a mail alert when the replication fails. I got the BASH script for replication but now I am stuck at mailing part..
I installed mailutils in Ubuntu and tried to send a mail. But, I get the following error
"Your access to this mail system has been rejected due to the sending MTA's IP xx.xx.xx.xxx poor reputation"
I found out that I can overcome this by getting it out of the list. But, I have 10s of those IPs and may change over time. So, is there any other method to use some server to send mails without the worry of removing IPs from SPAMHaus list?
I'd recommend using a smarthost, e.g. your provider's email server, and forward over it. That is, configure your local mail server (in Debian exim is the default, and I guess it's the same for Ubuntu) to use a smarthost for mail delivery and configure it for rewriting such that all mail from your system is locally forwarded to the accounts of the people dealing with your MySQL slaves and these people are aliased to external addresses.
This can be done via the /etc/aliases file, if I remember correctly.

nginx as mail proxy

I am trying to setup nginx as mail proxy. All i want is to let nginx receive the mail and forward it to a script. Is this set possible or should i only use sendmail for that.
The only way I can remotely imagine that working is if you would let nginx listen on the smtp port and run a smtp server web application on that port. At that point nginx would basically only connect the outside port to your locally running app.
So yeah, I think you would be much better off with a real smtp server like sendmail. Actually, I recommend you use postfix because it does the same thing arguably better.
there is a lack of documentation but from playing around with it
it looks to like the nginx mail options are for creating proxies to more easily add custom authentication to an existing MTA.
A use case might be to use a php script to authenticate existing website users using the website's existing users database without needing to create system users for them or set up extra databases.
so no, it won't forward the actual email to a script
(look for things like 'pipe_tansport' in MTA's like exim to do that)
but it will let you use a script to put authentication in front of an existing smtp server.

Resources