Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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
带有附件的PHP x Mailgun电子邮件_Php_Html_Mailgun - Fatal编程技术网

带有附件的PHP x Mailgun电子邮件

带有附件的PHP x Mailgun电子邮件,php,html,mailgun,Php,Html,Mailgun,我想用邮枪做一份时事通讯 它发送电子邮件很好,但我也需要能够发送附件,我尝试了很多方法来做到这一点,但似乎没有任何工作 你们能帮帮我吗 以下是我的代码:(PHP部分) <?php require_once ('init.php'); if(isset($_POST['subject'], $_POST['body'])) { $subject = $_POST['subject']; $body = $_POST['body']; $mailgun

我想用邮枪做一份时事通讯

它发送电子邮件很好,但我也需要能够发送附件,我尝试了很多方法来做到这一点,但似乎没有任何工作

你们能帮帮我吗

以下是我的代码:(PHP部分)

    <?php

require_once ('init.php');


if(isset($_POST['subject'], $_POST['body']))
{
    $subject = $_POST['subject'];
    $body = $_POST['body'];


    $mailgun->sendMessage(MAILGUN_DOMAIN, [
        'from'      => 'blablabla@gmail.com',
        'to'        => MAILGUN_LIST,
        'subject'   => $subject, 
        'html'      => "{$body}<br><br><a href=\"%unsubscribe_url%\">Unsubscribe</a>"
    ]);

    header ('Location ./');
}

    if(isset($_FILES['file'])) {
        $file = $_FILES['file'];
    }


?>

HTML部分:

    <body class="contact loading">


            <!--<header id="header">
                <h1 id="logo"><a href="index.html">Newsletters<span> | Teatro Aberto </span></a></h1>
            </header>!-->


            <article id="main">

                <header class="special container">
                    <span class="icon fa-envelope"></span>
                    <h2>Enviar</h2>
                    <p></p>
                </header>


                    <section class="wrapper style4 special container small">


                            <div class="content">
                                <form action="send.php" method="post">
                                    <div class="row half no-collapse-1">
                                    </div>
                                    <div class="row half">
                                        <div class="12u">
                                            <input type="text" name="subject" placeholder="Assunto" autocomplete="off"/>
                                        </div>
                                    </div>
                                    <div class="row half">
                                        <div class="12u">
                                            <textarea name="body" placeholder="Messagem" rows="7"></textarea>
                                        </div>
                                    </div>

                                    </br>

                                    <div class="row">
                                        <div class="12u">
                                            <ul class="buttons">
                                                <input type="submit" value="Enviar" class="button special">
                                            </ul>
                                        </div>
                                    </div>
                                </form>

                            </div>

                            </br>
                            </br>
                    </section>

            </article>


            <footer id="footer">

                <ul class="icons">
                    <li><a href="#" class="icon circle fa-facebook"><span class="label">Facebook</span></a></li>
                </ul>

                <span class="copyright">&copy;All rights reserved.  </span>

            </footer>

    </body>
</html>



&抄袭;版权所有。
谢谢