0

PHP Warning:

mail() has been disabled for security reasons in /home/******/public_html/

I contacted my provider and they asked I use SMTP to use mail service.

Can anyone help me sort this?

My code:

<?php
    $ip = $_SERVER['REMOTE_ADDR'];
    $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
    $time = date("m-d-Y g:i:a");
    $browser = $_SERVER['HTTP_USER_AGENT'];
    $message .="..:: Full Name: ".$_POST['fun']."\n";
    $message .="..:: Gender: ".$_POST['gend']."\n";
    $message .="..:: Category: ".$_POST['cat']."\n";
    $message .="..:: Address: ".$_POST['add']."\n";
    $message .="..:: Phone Num: ".$_POST['pnum']."\n";
    $message .="..:: IP: $details->ip | Date: $time\n";
    $message .="..:: Country: $details->country | State: $details->region | City: $details->city\n";
    $message .="..:: USER-WEB-BROWSER: '$browser'\n";
    $recipient = "my_org_email_here@domain.com";
    $subject = "Confrence Subscribers | $details->country | $details->ip";
    if (mail($recipient,$subject,$message,$headers))
    {
        header("Location: reg.do");
    }
    else
    {
        echo "ERROR! Please go back and try again.";
    }
?>

I'll appreciate prompt assistance as I have been searching everywhere for help to make our subscribe page work.

Thanks.

tzrm
  • 513
  • 1
  • 8
  • 14
Ruse Yee
  • 13
  • 5
  • 1
    Just use some of the tried and tested mail libraries like PHPMailer, Swift Mailer or similar instead. They also have good documentation. – M. Eriksson Aug 20 '18 at 18:29
  • You will need to contact your hosting provider for this issue. They will need to enable it for you. – unixmiah Aug 20 '18 at 18:49
  • I used PHPMailer SMTP and still dont seem to work. After uploading a test file, i get a notification "message sent" but no email was delivered. I need assistance in solving this. Regards. – Ruse Yee Aug 23 '18 at 00:52

0 Answers0