簡體   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