首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP发送问题(使用SendInBlue)

PHP发送问题(使用SendInBlue)
EN

Stack Overflow用户
提问于 2016-05-06 06:24:29
回答 1查看 1.3K关注 0票数 0

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

我的问题是,我的表单在1个站点上工作得很好,现在我正在为第二个站点使用完全相同的代码,只需更改电子邮件、名称等--但是,在测试它时,我现在得到了以下错误:

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

FYI,第71行是:

$mailin->send_email($data);

我已经附加了完整的代码下面-这是完美的工作在一个网站,但我得到这个错误在我的第二个网站。

有什么想法吗?

谢谢!

代码语言:javascript
复制
<?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");

}

?>

EN

回答 1

Stack Overflow用户

发布于 2016-06-08 02:56:53

我使用的是一个不推荐的Mailin.php。更新了文件,一切都正常了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37065669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档