繁体   English   中英

使用 php 和 mysql 将发票发送到电子邮件

[英]Send Invoice to email using php and mysql

我的英语语法不太好,但我希望有人理解我。

我想使用输入创建和发送发票。 就像带有电子邮件密钥确认的注册页面。

例子。

我有发票信息.php

<script><?php

session_start();
$_SESSION['invoice'] = $invoice;
$_SESSION['name'] = $name;
$_SESSION['address'] = $address;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;



?></script>
<html>
<h3 align="center">Invoice Information</H3>
<form align="center" method="get" action="**Auto create by invoice value**">
    <input type="text" name="invoice" value="" placeholder="Invoice#"><br>
    <input type="text" name="name" value="" placeholder="Buyer Name"><br>
    <input type="text" name="address" value="" placeholder="Address"><br>
    <input type="text" name="city" value="" placeholder="City"><br>
    <input type="text" name="state" value="" placeholder="State"><br>
    <input type="text" name="zip" value="" placeholder="Zip Code"><br>
    <input type="submit">
</form>

</html>

在那个“按发票价值自动创建”我想把这个,

<?php

session_start();
$invoice = $_GET['invoice'];
$name = $_GET['name'];
$address = $_GET['address'];
$city = $_GET['city'];
$state = $_GET['state'];
$zip = $_GET['zip'];
?>

<!DOCTYPE HTML>
<html lang="en-US">
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
      <meta name="MobileOptimized" content="width" />
      <meta name="HandheldFriendly" content="true" />
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
      <title><?php echo $invoice; ?></title>
</head>
<body>
<small><font size="2" color="#999999" face="verdana,
            sans-serif"><b><span class=""> sent this invoice to


            <br><?php echo $name; ?><br>


            Your registered name is included to show this invoice from Company</b></font>

<span>Your address is : <?php echo $address; ?>
<span>Your City is : <?php echo $city; ?>
<span>Your Zip Code is : <?php echo $zip; ?>
<span>Your State is : <?php echo $state; ?>
</body>
</html>

之后我想创建<?php echo $invoice; ?> <?php echo $invoice; ?> .php 带有“按发票价值自动创建”源代码。

之后我想发送一封电子邮件,但我需要一封电子邮件,如下所示:

信件.php

<h3>Thanks for using company ! <br>Here's your invoice.<br></h3>

<a href="https://example.com/<?php echo $invoice; ?>.php" >View Invoice</a>

或者更容易……当然,如果我可以的话!

首先,我不知道什么是“按发票价值自动创建”。 但我可以为您提供一些信息。

假设您有 3 页并且您没有数据库:

  1. 发票信息.php
  2. 自动创建.php
  3. 信件.php

哪一个

  1. invoiceinformation.php 是使用表单收集用户表单的值并将所有这些值发送到 AutoCreate.php
  2. AutoCreate.php 显示用户输入的所有这些值,并确认用户输入是否正确,如果输入不正确,它将重定向到 invoiceinformation.php 页面,用户重新输入那些不正确的输入
  3. Letter.php 用于检索信息并通知用户您将向其各自的电子邮件地址发送电子邮件。

很简单,您不需要在 invoiceinformation.php 中的那些会话而是在 AutoCreate.php 中设置这些会话

$to = $_SESSION['email'];
$subject = "Invoice";
$txt = "Hello world!"; //this is the body text u can put ur invoice here
$headers = "From: webmaster@example.com" . "\r\n" . // this is your site email & user email (CC)
"CC: somebodyelse@example.com";

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM