我有一个基本的PHP表单,我在几个站点上使用它,它使用SendInBlue API发送电子邮件。
我的问题是,我的表单在1个站点上工作得很好,现在我正在为第二个站点使用完全相同的代码,只需更改电子邮件、名称等--但是,在测试它时,我现在得到了以下错误:
致命错误:调用第71行/URL/contactpage.php中未定义的方法Mailin::send_email()
FYI,第71行是:
$mailin->send_email($data);
我已经附加了完整的代码下面-这是完美的工作在一个网站,但我得到这个错误在我的第二个网站。
有什么想法吗?
谢谢!
<?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");
}?>
发布于 2016-06-08 02:56:53
我使用的是一个不推荐的Mailin.php。更新了文件,一切都正常了。
https://stackoverflow.com/questions/37065669
复制相似问题