Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 付款后发送邮件贝宝联系表7_Wordpress_Email_Paypal_Contact Form 7 - Fatal编程技术网

Wordpress 付款后发送邮件贝宝联系表7

Wordpress 付款后发送邮件贝宝联系表7,wordpress,email,paypal,contact-form-7,Wordpress,Email,Paypal,Contact Form 7,我在WordPress网站上有一个联系表7。 当您单击“提交”时,您将在Paypal上重定向,并很乐意支付:)。一切都很好,但我想要更多。 我想发送邮件,只有当访问者在Paypal上付费时。 我已经在谷歌上搜索过了,但我还没有找到这样做的方法 有什么想法吗 谢谢 内森你可以用它来完成这件事。有一个非常简单的方法,但是您需要从functions.php文件(或您自己的插件)中创建一个基本的钩子,根据您希望发送的时间触发电子邮件 您可以根据不同的PayPal交易类型或付款状态触发任何您想要的操作 下

我在WordPress网站上有一个联系表7。 当您单击“提交”时,您将在Paypal上重定向,并很乐意支付:)。一切都很好,但我想要更多。 我想发送邮件,只有当访问者在Paypal上付费时。 我已经在谷歌上搜索过了,但我还没有找到这样做的方法

有什么想法吗

谢谢

内森

你可以用它来完成这件事。有一个非常简单的方法,但是您需要从functions.php文件(或您自己的插件)中创建一个基本的钩子,根据您希望发送的时间触发电子邮件

您可以根据不同的PayPal交易类型或付款状态触发任何您想要的操作

下面是一个从扩展发送电子邮件到IPN插件的非常基本的示例。这是一个完整的插件文件,只有一个插件的挂钩。在本例中,我使用的是paypal的ipn,用于wordpress的txn类型的购物车

<?php
/**
 * @package PayPal IPN for WordPress - Hook Template
 * @version 1.0.0
 */
/*
Plugin Name: PayPal IPN for WordPress - Hook Template
Plugin URI: http://www.angelleye.com/
Description: Hook tester for PayPal IPN for WordPress plugin.
Author: angelleye
Version: 1.0.0
*/


add_action('paypal_ipn_for_wordpress_txn_type_cart', 'paypal_ipn_for_wordpress_txn_type_cart', 10, 1);
function paypal_ipn_for_wordpress_txn_type_cart($posted) {

    // Parse data from IPN $posted array

    $payment_status = isset($posted['payment_status']) ? $posted['payment_status'] : '';
    $mc_gross = isset($posted['mc_gross']) ? $posted['mc_gross'] : '';
    $first_name = isset($posted['first_name']) ? $posted['first_name'] : '';
    $last_name = isset($posted['last_name']) ? $posted['last_name'] : '';
    $cart_items = isset($posted['cart_items']) ? $posted['cart_items'] : '';

    /**
     * At this point you can use the data to generate email notifications,
     * update your local database, hit 3rd party web services, or anything
     * else you might want to automate based on this type of IPN.
     */
    $to = 'email@domain.com';
    $subject = 'Email from PayPal IPN';
    $message = 'Order Total: ' . $mc_gross . "\n";
    $message .= 'Payment Status: ' . $payment_status . "\n";
    $message .= 'Name: ' . $first_name . ' ' . $last_name . "\n";
    $message .= 'Cart Items: ' . print_r($cart_items, true);
    wp_mail( $to, $subject, $message );
}
当然,你可以花时间使电子邮件更漂亮,并将其发送到任何你需要的电子邮件地址

同样,您可以根据不同的IPN类型或支付状态,使用触发您自己的插件函数


这里的示例仅包括IPN提供的几个数据参数,但WordPress中的IPN记录将为您提供一个模板,您可以轻松地复制/粘贴到您自己的插件文件中,该文件包含该类型IPN可用的每个IPN参数。

列出的当时不可用,是否有其他活动插件?

好的,谢谢,我已经安装了插件,我已经了解它的功能!但我必须了解如何在联系人表单7和Paypal IPN之间进行挂钩,这可能很难。你不会真的在这两个插件之间挂钩。联系表格7(或处理贝宝付款的任何方法)将向贝宝发送付款。然后,PayPal的服务器将触发IPN发送到您使用插件配置的URL。然后,您可以在IPN插件中单独添加一个钩子,以根据IPN访问该URL的时间触发您自己的事件。不久,我将为此编写一个教程,但可能要过几天我才能完成。是的,谢谢你的解释,当你谈论这个时看起来很容易,但实际上。。。哈哈。我得搜索你到底在哪里被卡住了?我刚刚更新了答案,提供了更多关于如何完成的细节。您只需复制/粘贴其中的内容并进行相应的调整。这并不能提供问题的答案。一旦你有足够的钱,你将能够;相反,提供不需要询问者澄清的信息。
Order Total: 90.27
Payment Status: Completed
Name: Tester Testerson
Cart Items: Array
(
    [0] => Array
        (
            [item_number] =>
            [item_name] => Woo Album #2
            [quantity] => 1
            [mc_gross] => 75.27
            [mc_handling] => 0.00
            [mc_shipping] => 0.00
            [custom] =>
            [option_name1] =>
            [option_selection1] =>
            [option_name2] =>
            [option_selection2] =>
            [btn_id] =>
            [tax] => 0.00
        )

)