从lcoalhost mamp发送邮件

时间:2016-08-18 20:55:53

标签: php email localhost mamp

我从我的localhost(mamp)发送邮件时感到非常疯狂。 有趣的是,它已经在运作 - 但现在停止了。 我希望你能以任何方式帮助我......下面的代码:

PHP

function contactMail () {

    global $connection;

    if(isset($_POST["send"])) {

        $vorname = ($_POST["vorname"]);
        $nachname = ($_POST["nachname"]);
        $email = $_POST["email"];
        $user_subject = $_POST["betreff"];
        $user_msg = $_POST["anliegen"];
        $to = "0916.abschlussprojekt@gmail.com";
        $subject = "Kontaktformular:" . $user_subject;
        $message = "Name:" . $vorname;

        $vorname = mysqli_real_escape_string($connection, $vorname);
        $nachname = mysqli_real_escape_string($connection, $nachname);
        $email = mysqli_real_escape_string($connection, $email);
        $user_subject = mysqli_real_escape_string($connection, $user_subject);
        $user_msg = mysqli_real_escape_string($connection, $user_msg);

        $query = "INSERT INTO contact (vorname, nachname, email, betreff, text) 
                 VALUES ('$vorname', '$nachname', '$email', '$user_subject', '$user_msg')";

        $result = mysqli_query($connection, $query);

        if(!$result) {
            die("could not store msg" . mysqli_error($connection));   
        }

        mail($to, $subject, $message);

    }

}

php.ini中的设置

[mail function]
; For Win32 only.
; SMTP = smtp-mail.outlook.com
; smtp_port = 587
; For Win32 only.
; sendmail_from = me@example.com
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i -f  xxxxxxx@hotmail.de

我已经尝试使用SMTP和端口未注释。

htaccess

Options +MultiViews 
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

我被困在这里。

0 个答案:

没有答案