SMTP on linux
If I want to set up a simple SMTP relay on linux that can be used by PHP for sending emails. What is the simplest way to achive this?
The system will not need to recive emails, just act as a realy to allow various websites to send out admin mails. For example wordpress.
Do i need to install a complete mailserver solution, or is there a simpler way to achive this?
I keep reading that phpmail() works by default, but this has never been the case for me.
All I want is a simple solution, the full blown email set up is going to come later. I was thinking I could jsut install something like postfix and do some basic config.
Devil
The system will not need to recive emails, just act as a realy to allow various websites to send out admin mails. For example wordpress.
Do i need to install a complete mailserver solution, or is there a simpler way to achive this?
I keep reading that phpmail() works by default, but this has never been the case for me.
All I want is a simple solution, the full blown email set up is going to come later. I was thinking I could jsut install something like postfix and do some basic config.
Devil
- If you can't explain it simply, you don't understand it well enough. Albert Einstein
- An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
Linkin Profile - Blog: http://Devilwah.com
Comments
-
NightShade03 Member Posts: 1,383 ■■■■■■■□□□You are correct Postfix is the way to go. Postfix will allow you to have SMTP functionality without the need for receiving mail as well. You can then use PHP mail functions to send out mail. Just a note to make sure that you do a little basic security for Postfix so that it doesn't end up being an open relay for spammers. Their website has a decent walk through to get you going in about 10 minutes.
Here is a sample of PHP code in case you need it (it was from a helpdesk web application that I wrote).function helpdesk_email($name, $dept, $pri, $prob){ $to = 'admin@company.com'; $sub = 'New Ticket Submitted'; $message = ' <html><table><tr><td>Name: '. $name .'</td></tr> <tr><td>Dept: '. $dept .'</td></tr> <tr><td>Priority: '. $pri .'</td></tr> <tr><td>Problem: '. $prob .'</td></tr> </table> </html> '; $headers = "From: [email]helpdesk@company.com[/email]\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $sub, $message, $headers); }
-
DevilWAH Member Posts: 2,997 ■■■■■■■■□□NightShade03 wrote: »You are correct Postfix is the way to go. Postfix will allow you to have SMTP functionality without the need for receiving mail as well. You can then use PHP mail functions to send out mail. Just a note to make sure that you do a little basic security for Postfix so that it doesn't end up being an open relay for spammers. Their website has a decent walk through to get you going in about 10 minutes.
Here is a sample of PHP code in case you need it (it was from a helpdesk web application that I wrote).function helpdesk_email($name, $dept, $pri, $prob){ $to = 'admin@company.com'; $sub = 'New Ticket Submitted'; $message = ' <html><table><tr><td>Name: '. $name .'</td></tr> <tr><td>Dept: '. $dept .'</td></tr> <tr><td>Priority: '. $pri .'</td></tr> <tr><td>Problem: '. $prob .'</td></tr> </table> </html> '; $headers = "From: [EMAIL="helpdesk@company.com"]helpdesk@company.com[/EMAIL]\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $sub, $message, $headers); }
Ok i can't give you more rep (system don't allow it) but cheers for the pointers, all up and working now- If you can't explain it simply, you don't understand it well enough. Albert Einstein
- An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
Linkin Profile - Blog: http://Devilwah.com -
Chris:/* Member Posts: 658 ■■■■■■■■□□NightShade03 wrote: »You are correct Postfix is the way to go. Postfix will allow you to have SMTP functionality without the need for receiving mail as well. You can then use PHP mail functions to send out mail. Just a note to make sure that you do a little basic security for Postfix so that it doesn't end up being an open relay for spammers. Their website has a decent walk through to get you going in about 10 minutes.
Agreed!Degrees:
M.S. Information Security and Assurance
B.S. Computer Science - Summa Cum Laude
A.A.S. Electronic Systems Technology -
earweed Member Posts: 5,192 ■■■■■■■■■□Ok i can't give you more rep (system don't allow it) but cheers for the pointers, all up and working nowNo longer work in IT. Play around with stuff sometimes still and fix stuff for friends and relatives.
-
Pash Member Posts: 1,600 ■■■■■□□□□□DevOps Engineer and Security Champion. https://blog.pash.by - I am trying to find my writing style, so please bear with me.
-
TechJunky Member Posts: 881I think its what you are more comfortable with.
I myself perfer Sendmail just because I have set them up since 1999.