【问题标题】:How to send html form to emails and google spreadsheet如何将 html 表单发送到电子邮件和谷歌电子表格
【发布时间】:2014-11-26 12:14:45
【问题描述】:

我有自己的表单,可以将消息发送到两封电子邮件。它正在工作。

我想将相同的数据从 $_[POST] 保存到谷歌文档。

如何将数据发送到 2 封电子邮件和 google 电子表格?

HTML 代码:

<form role="form" action="mail.php" method="post">
                <input type="text" name="company" id="company" class="form-control" placeholder="Your company">
                <input type="text" name="city" id="city" class="form-control" placeholder="City">
                <input type="text" name="person" id="person" class="form-control" placeholder="Name and surname">
                <input type="tel" name="phone" id="phone" class="form-control" placeholder="Phone number">
                <input type="email" name="email" id="email" class="form-control" placeholder="E-mail">
                <button type="submit" id="submit-btn" class="btn btn-default">Submit</button>
</form>

邮件.php

<?php
$to      = 'user1@domain.com, user2@domain.com'; 
$subject = 'email from domain.com';
$company = $_POST['company'];
$city = $_POST['city'];
$person = $_POST['person'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message = '<b>Message from website</b>'. "\r\n". "<br>" .
            '<b>Company:</b> '. $company . "\r\n". "<br>" .
            '<b>City:</b> '. $city . "\r\n". "<br>" .
            '<b>Person:</b> '. $person . "\r\n". "<br>" .
            '<b>Phone:</b> '. $phone . "\r\n" . "<br>" .
            '<b>Email:</b> '. $email . "\r\n";
$headers = 'From: ' . 'companies@domain.com' . "\r\n" .
    'Content-type: text/html; charset=utf-8';

mail($to, $subject, $message, $headers);

echo "Thank You, your email has been sent!<br />"; 
include 'success.php';
?>

我看到我可以创建谷歌表单并替换我的表单,但这样我只能将数据保存到电子表格,而不能发送电子邮件。

如何结合这两种功能?

感谢所有提示。

【问题讨论】:

    标签: php email google-sheets google-docs


    【解决方案1】:

    Google Sheets API。点击“协议”选项卡。

    您可以在此处找到如何将列表行发布到 Google 表格的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-07
      • 1970-01-01
      • 1970-01-01
      • 2021-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-05
      相关资源
      最近更新 更多