2016-05-06 18 views
0

私はいくつかのサイトで使用する基本的なPHPの連絡フォームを用意しています。これはSendInBlue APIを使用してメールを送信します。PHPフォームの送信に関する問題(SendInBlueを使用)

私の問題は、フォームが完全に1つのサイトで動作していることです。今は2番目のサイトに同じコードを使用していて、電子メール、名前などを変更しています。

Fatal error: Call to undefined method Mailin::send_email() in /URL/contactpage.php on line 71

FYI、ライン71は、次のとおりです。

$mailin->send_email($data);

私は、以下の完全なコードを添付している - これは、1つのサイト上で完璧に動作しますが、私は私の第二のサイトで、このエラーを取得します。

アイデア?

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

<?php 

//Email Details for Form Notifications 
$email_to = '[email protected]'; //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"); 

} 

?>

+0

私は、このコードが1つのドメインで完全に機能することを発見しましたが、同じドメインの別のURLでエラーを返します...コードは機能しますが、特定の場所には存在したくありません。すべての必要なファイルはまったく同じです... – Scott

答えて

0

私は非推奨Mailin.phpを使用していました。ファイルが更新され、すべて正常に機能します。

関連する問題