0

SendInBlue APIを使用して電子メールを送信する、いくつかのサイトで使用する基本的な PHP 連絡フォームがあります。

私の問題は、フォームが 1 つのサイトで完全に機能していることです。現在、2 番目のサイトにまったく同じコードを使用し、電子メール、名前などを変更しているだけですが、テストすると次のエラーが発生します。

致命的なエラー: /URL/contactpage.php の 71 行目の未定義メソッド Mailin::send_email() の呼び出し

参考までに、71行目は次のとおりです。

$mailin->send_email($data);

以下に完全なコードを添付しました。これは 1 つのサイトでは完全に機能しますが、2 つ目のサイトではこのエラーが発生します。

何か案は?

ありがとうございました!

<?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