-1

Im new here. Im trying to send an E-Mail to someone using PHP. While looking around, i found some information that helped me, but didnt solve the problem. I dont know where the mistake could be.

When i try to send the form, i get an empty site, which means that i didnt get any errors. But i dont receive a mail.

What i have already tried:

  • Changes in php.ini & sendmail.ini
  • Trying to get an error with error_get_last()

The code i use:

mail.php

    <?php
    $m = $_POST['mail'];
    $b = $_POST['subject'];
    $z = $_POST['time'];
    $d = $_POST['date'];
    $hf = $_POST['mw'];
    $f = $_POST['company'];
    $t = $_POST['phone'];
    $ta = $_POST['ta'];
    $n = "test";

    if(!empty($_POST['ha'])){$ha = "Something";} else { $ha = "Something else";}
    if(!empty($_POST['hz'])){$hz = "Something";} else { $hz = "Something else";}
    if(!empty($_POST['rwa'])){$rwa = "Something";} else { $rwa = "Something else";}
    if(!empty($_POST['ba'])){$ba = "Something";} else { $ba = "Something else";}

    mail($m, $b, $n); ?>

php.ini

SMTP = smtp.gmail.com 
smtp_port = 587
sendmail_from = gluray.simons@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
;sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"
sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
mail.add_x_header=Off

sendmail.ini

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=gluray.simons@gmail.com
auth_password=mypassword
force_sender=gluray.simons@gmail.com

I use Xampp Control Panel v3.2.2, PHP 5.6.15

Thanks in advance.

  • 2
    Read [PHP mail form doesn't complete sending e-mail](http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail). Also, if you get an "empty site", it might suggest you got some syntax/parse errors, see [`error_reporting(E_ALL);`](http://php.net/manual/en/function.error-reporting.php) [`ini_set('display_errors', 1);`](http://php.net/manual/en/function.ini-set.php) – Qirel Feb 01 '16 at 15:55
  • And, just a suggestion - you can use tenary operators for cleaner code on your `if`-blocks. Would look like `$ha = (!empty($_POST['ha']) ? "Something" : "Something else");` – Qirel Feb 01 '16 at 15:57

1 Answers1

-3

Use mandrill instead, and you will not depend on php mailing

kasynych
  • 50
  • 2