а√在线中文网新版地址在线,播五月开心婷婷综合,午夜国产精品视频在线,√8天堂资源地址中文在线,80岁色老头oldmanvideos

注冊送短信

DEMO: Mail/XSend - 郵件模板發(fā)送


代碼示例


<?php
<?php
    /*****************
     * 非加密請求 示例代碼
     ******************/
    //appid參數 appkey參數在     郵件-創(chuàng)建/管理AppID中獲取
    //郵件模板ID   郵件-創(chuàng)建/管理郵件模板中獲得
    //郵件模板對應變量
    //  若模板為:您的驗證碼是@var(code),請在@var(time)內輸入。郵件模板對應變量如下
    //  變量名和自定義內容相對應即可
    $appid = '6***3';                                                               //appid參數
    $appkey = '5d****************************58';                                   //appkey參數
    $from = 'from@domain.com';                                                      //發(fā)送人 郵箱
    $to = 'to@domain.com';                                                          //接收人 地址
    $project = 'F*****U';                                                           //郵件模板ID
    $vars = json_encode(array(                                                      //郵件模板對應變量
        'code' => '1111',
        'time' => '三分鐘'
    ));

    $post_data = Array(
        "appid"     => $appid,
        "signature" => $appkey,
        "from"      => $from,
        "to"        => $to,
        "project"   => $project,
        "vars"      => $vars,
    );

    $ch = curl_init();
    curl_setopt_array($ch , array(
        CURLOPT_URL             => 'https://api-v4.mysubmail.com/mail/xsend.json' ,
        CURLOPT_RETURNTRANSFER  => 1 ,
        CURLOPT_POST            => 1 ,
        CURLOPT_POSTFIELDS      => $post_data
    ));
    $output = curl_exec($ch);
    curl_close($ch);

    echo json_encode($output);



    /*****************
     * 加密請求 示例代碼
     ******************/
    //appid參數 appkey參數在     郵件-創(chuàng)建/管理AppID中獲取
    //郵件模板ID   郵件-創(chuàng)建/管理郵件模板中獲得
    //郵件模板對應變量
    //  若模板為:您的驗證碼是@var(code),請在@var(time)內輸入。郵件模板對應變量如下
    //  變量名和自定義內容相對應即可
    $appid = '6***3';                                                               //appid參數
    $appkey = '5d****************************58';                                   //appkey參數
    $from = 'from@domain.com';                                                      //發(fā)送人 郵箱
    $to = 'to@domain.com';                                                          //接收人 地址
    $project = 'F*****U';                                                           //郵件模板ID
    $vars = json_encode(array(                                                      //郵件模板對應變量
        'code' => '1111',
        'time' => '三分鐘'
    ));

    //通過接口,獲取時間戳
    $ch = curl_init();
    curl_setopt_array($ch , array(
        CURLOPT_URL             => 'https://api-v4.mysubmail.com/service/timestamp.json' ,
        CURLOPT_RETURNTRANSFER  => 1 ,
        CURLOPT_POST            => 0 ,
    ));
    $output = curl_exec($ch);
    curl_close($ch);
    $output = json_decode($output,true);
    $timestamp = $output['timestamp'];

    $post_data = Array(
        "appid"         => $appid,
        "from"          => $from,
        "to"            => $to,
        "project"       => $project,
        "vars"          => $vars,
        "sign_version"  => 2,
        "sign_type"     => 'md5',
        "timestamp"     => $timestamp,
    );

    $temp = $post_data;
    unset($temp['vars']);
    ksort($temp);
    reset($temp);
    $tempStr = "";
    foreach ($temp as $key => $value) {
        $tempStr.=$key."=".$value."&";
    }
    $tempStr = substr($tempStr,0,-1);
    //生成簽名
    $post_data['signature'] = md5($appid.$appkey.$tempStr.$appid.$appkey);

    $ch = curl_init();
    curl_setopt_array($ch , array(
        CURLOPT_URL             => 'https://api-v4.mysubmail.com/mail/xsend.json' ,
        CURLOPT_RETURNTRANSFER  => 1 ,
        CURLOPT_POST            => 1 ,
        CURLOPT_POSTFIELDS      => $post_data
    ));
    $output = curl_exec($ch);
    curl_close($ch);

    echo json_encode($output);