PHP表单发送问题(使用SendInBlue)

时间:2016-05-06 06:24:29

标签: php forms sendinblue

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

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

  

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

仅供参考,第71行是:

  

$ mailin-&GT; SEND_EMAIL($数据);

我已附上以下完整代码 - 这在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");

}

&GT;

1 个答案:

答案 0 :(得分:0)

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