0

我有一个基本的 PHP 联系表格,我在几个网站上使用它,它使用SendInBlue API 发送电子邮件。

我的问题是我的表单在 1 个站点上完美运行,现在我在第二个站点使用完全相同的代码,只是更改了电子邮件、名称等 - 但是在测试它时,我现在收到此错误:

致命错误:在第 71 行的 /URL/contactpage.php 中调用未定义的方法 Mailin::send_email()

仅供参考,第 71 行是:

$mailin->send_email($data);

我附上了下面的完整代码 - 这在 1 个站点上完美运行,但在我的第二个站点上出现此错误。

有任何想法吗?

谢谢!

<?php

//Email Details for Form Notifications
$email_to =   'Test@test.com'; //the address to which the email will be sent 
$email_to_name     =  'Test';

//Form Fields
$fname     =   $_POST['firstname'];
$lname     =   $_POST['lastname'];
$email    =   $_POST['email'];
$fullmessage    =   $_POST['message'];

//Subject Lines
$subject_to  =   'Test';
$subject_touser  =   'Test';

//URL Redirects
$confirm  =   'TestConfirm';
$errorurl  =    'TestError';

//Validate
$emailval = filter_var( $email, FILTER_VALIDATE_EMAIL );
if ($emailval == false)
{
    header("Location: $errorurl");
} else {

    // The email to us
    $message_to = 'Message here';
    //

    // The email to them
    $message_touser = 'Message here';
    //

    require('Mailin.php');

    //Notification Email
    $mailin = new Mailin('https://api.sendinblue.com/v2.0','MY_KEY');
    $data = array( "to" => array($email_to=>$email_to_name),
                "cc" => array($email_to_cc=>$email_to_cc_name),
                "from" => array($email,$fname),
                "subject" => $subject_to,
                "html" => $message_to
    );

    $mailin->send_email($data);

    //Email to User
    $mailin = new Mailin('https://api.sendinblue.com/v2.0','MY_KEY');
    $data2 = array( "to" => array($email=>$fname),
                "from" => array($email_to,$email_to_name),
                "subject" => $subject_touser,
                "html" => $message_touser
    );

    $mailin->send_email($data2);  

    header("Location: $confirm");

}

?>

4

1 回答 1

0

我使用的是已弃用的 Mailin.php。更新了文件,现在一切正常。

于 2016-06-08T02:56:53.033 回答