0

I'm always having this error whenever I try to send an email verification

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\register\MailSend.php on line 43

elixenide
  • 44,308
  • 16
  • 74
  • 100
  • 1
    At the risk of asking the obvious, are you running a mail server on port 25? On Windows, unless you have deliberately installed one yourself, the answer is almost certainly no. – elixenide Apr 07 '18 at 12:23
  • How do I change my port ? Can't find it on my php.ini file in xampp – Lance Ebacuado Apr 07 '18 at 12:24
  • And how do i know if I'm running on port 25? – Lance Ebacuado Apr 07 '18 at 12:25
  • well, as the error message indicates, you would set the value of `smtp_port`. But that’s not going to help you if you don’t have a mail server running. – elixenide Apr 07 '18 at 12:26
  • 2
    Remember the `mail()` function does not actually send email. It just passes it to a real Mail Server. – RiggsFolly Apr 07 '18 at 12:26
  • @LanceEbacuado the first question is whether you’re running a mail server *at all*. If you are, then you can worry about the port (which is overwhelmingly likely to be 25). If you aren’t, all of this is moot. You almost certainly aren’t, based on this error and your questions. – elixenide Apr 07 '18 at 12:27
  • Are you running on WINDOWS? – RiggsFolly Apr 07 '18 at 12:28
  • Yup running on windows 10 – Lance Ebacuado Apr 07 '18 at 12:29
  • 1
    Then unless you installed an Email Server you dont have one! Take a look at a PHP based library called `phpMailer`. that will allow you to use a Gmail/Yahoo/etc emailaccount to send email. Alternatively if you think you have the skills or time,look for `hMailServer` its a windows mail server – RiggsFolly Apr 07 '18 at 12:34
  • Hey @riggsFolly Do you have any private account where I can message you to discuss about my problem ? Thanks – Lance Ebacuado Apr 07 '18 at 12:38
  • That Dup Should give you some clues – RiggsFolly Apr 07 '18 at 12:40
  • Someone said that i need to have a web hosting service before I can send an email to a user, is that really needed? – Lance Ebacuado Apr 07 '18 at 14:17

0 Answers0