How to send emails with PHP from a highly secure network?

I want to send an email from my localhost machine (using the PHP mail function), but I cannot do that as I do not have a mail server. Also, I need to be able to send email over a network that is heavily protected by a firewall (as far as I don't know yet).

My idea is to use "QK SMTP Server 3" and get this to use an external server which I have as "Relay server". Will this work? Is there an easier option?

If my approach is OK. I would like to know how can I open port 25 on my server so that it can receive this request. By running this command, I get:

[root@balder296 ~]# service iptables status
Firewall is stopped.
[root@balder296 ~]#

      

Thanks for any help and advice.

solved

Hotmail (unexpectedly) provides a free relay service. Hope this works for me when I check it out! But an external mail server is the way to go.

0


source to share


6 answers


Find out if you can connect to the Internet on port 25 (SMTP)

  • telnet gmail-smtp-in.l.google.com 25

    (this is one of the Gmail servers)

If you can open a connection, you can simply set up a mail server and use the mail () function to send messages.

  • yum install postfix

    (for example from your note "service" I assume you are using Redhat or Centos)


If you are unable to connect to the Internet mail servers on port 25, you can try looking for the internal mail relay (you will need to find this depending on your network).

At this point, you have two options. You can use the internal mail () function with your local mail server if you define the "relay" parameter on your mail server (/ etc / postfix if using Postfix).

Another option is to follow this tutorial and get PHP to send messages to the internal relay.

+2


source


There may be a (good?) Reason explaining why the network you are on is heavily firewall protected.



Why don't you ask the guy on the net what is a good solution for sending mail?

+1


source


If you have a Google Mail account, you can use it to send email using Swift Mailer .

0


source


You will need a machine behind a firewall running a mail server. Preferably, it should be all you need to use it for. While everything else behind it should be blocked from opening outgoing connections on port 25, it should. Have a mail server on the machine that is running your application through that machine. I work for a hosting company and what do we do with our shared hosting servers. This way, you can monitor any outgoing mail to ensure that nothing is doing anything behind the firewall.

You friendly neighbor sysadmin will almost certainly set this up if you ask nicely.

0


source


If this is going to be a public application, keep in mind that even if you can get SMTP access, you are likely to run into problems in the future. Spam protection has become quite picky about network behavior. For example, there is a valid SMTP server on the network and you are configuring a different one, which can cause problems for both servers if they have the same IP address from outside the network. A couple of basic blacklists automatically block addresses that appear to contain more than one server.

If you are trying to bypass a network administrator, at best you will most likely have a fragile system. Depending on your network rules / settings, you MAY configure your SMTP server to send messages from another email server on the network. This should require working with a network administrator or email.

0


source


I've used SwiftMailer in the past and then set up a shared Gmail account to send mail. The only thing I have learned is that it is best to keep the address on behalf of, since the gmail account you set up, otherwise spam filters tend to be email junk.

0


source







All Articles