如何在页面重定向之前发送电子邮件
-
22-09-2019 - |
题
因此,在我的网站上,我启用了PayPal,但是当用户单击“立即购买”按钮时,我想向商店所有者发送电子邮件,然后再将其重定向到Paypal.com。我无法想到如何为我的一生做到这一点,因为(我认为)它曾经在我的页面重定向之前寄到我的页面。有任何想法吗?发送此电子邮件绝对至关重要。该页面在带有C#的ASP.NET中。
贝宝代码是:
form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="form1" runat="server">
input type="hidden" name="cmd" value="_xclick" />
input type="hidden" name="lc" value="US" />
input type="hidden" name="item_name" value="Lollipops Gift Baskets Order" />
input type="hidden" id="paypal_amount" runat="server" name="amount" value="56.00" />
input type="hidden" name="currency_code" value="USD" />
input type="hidden" name="button_subtype" value="products" />
input type="hidden" name="tax_rate" value="0.000" />
input type="hidden" id="paypal_shipping" runat="server" name="shipping" value="0.00" />
input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" id="submit1" runat="server" />
img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
/form>
解决方案 2
我从表单标签中删除了动作,并在做出响应之前做了我需要的所有幕后工作。https://www.paypal.com/cgi-bin/webscr“。似乎有效。
其他提示
假设该表格最终会在Paypal.com上生成HTML,那么您在单击服务器时不会收到对服务器的请求。您需要做类似的事情:
- 将请求发送到您的服务器,让它发送电子邮件并提交帖子,或者
- 使用ajax或类似于浏览器的请求(这本质上是不安全的,所以甚至不要考虑使用它来这样做,例如,一封电子邮件说“ Go Ship the Lollypops”)。
- 如果有PayPal API允许您指定“交易完成后在哪里重定向”或类似地址,则可能您可以将其引导回您并发送电子邮件?
不隶属于 StackOverflow