0

I am currently working on a new website using php, in which I have a form to automaticaly send emails to my adress.

I use the mail() php function, and I have it up and running using xampp and mercury on my localhost.

My question is, wether I need any special configurations when I start hosting my website at a hosting provider. Will it simply work through the mail() function? Or do I need to add more to it to make it work?

mail($email_to, $email_subject, $email_message, $headers);

I simply use this getting the message from a form.

Thanks in advance

SjoerdvdBelt
  • 190
  • 1
  • 3
  • 12
  • 2
    It usually "just works" but your host will have more information on this. – John Conde Oct 21 '14 at 19:02
  • 1
    When it works it's OK. Often it doesn't 'just work' and debugging it can be a nightmare. Do yourself a favour and start with [PHPMailer](http://phpmailer.worxware.com/) which is a whole lot easier. –  Oct 21 '14 at 19:05
  • You host should have a help section that covers this. – Jonathan Kuhn Oct 21 '14 at 19:06
  • 1
    Your hosting company usually sits on a single server that shares mail software such as sendmail. It will work as it is. Its better that you're on a shared host if you're starting things off; if it doesn't work, you can easily send them an email and they will make sure that sendmail is running. If you're on a managed host, you will need to install sendmail. If you were to use the mail function and get a error, its because you don't have either sendmail installed or have the path configured properly in your php.ini settings. – unixmiah Oct 21 '14 at 19:06
  • What i'll probably do is just try it as is, and if neccessary contact the hosting company. What is exactly the advantage of PHPmailer? Thanks for the quick responses btw! – SjoerdvdBelt Oct 21 '14 at 19:11
  • @Soj/Mike W. Mike made a good point. You're better off using phpmailer; its got ton of checks that's already built in there that you'd be unble to do on your own unless you script it from the bottom up. If you go to the github page for PHPMailer there is an example folder in there where you can pick and choose in which way you'll be sending your emails. – unixmiah Oct 21 '14 at 20:13
  • Alright, i'll try phpmailer – SjoerdvdBelt Oct 22 '14 at 11:49

0 Answers0