网站内的电子邮件表格(不是 mailto 链接),哪种语言?

发布于 2024-09-28 09:06:23 字数 93 浏览 0 评论 0原文

我想知道我需要使用什么语言来创建一个简单的表单来通过电子邮件发送网站上的电子邮件地址。

我需要使用什么语言才能实现这一点?它是否需要在服务器端?我想是这样。

I was wondering what language I need to use in order to create a simple form for emailing an email address on a website.

What language do I need to use in order to make this happen, and does it need to be server-side? I would imagine so.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

九八野马 2024-10-05 09:06:23

如果不使用“mailto:”链接,则需要在服务器端进行。您使用的语言可能受到托管平台的限制,以及支持哪些语言,或者可以添加哪些支持。

Without using a "mailto:" link, this will need to be server side. The language you use may be restricted by the hosting platform, and what languages are supported, or for which support can be added.

美人骨 2024-10-05 09:06:23

是的,服务器端..我使用 PHP 和 AJAX 的组合来实现这一点,并集成了验证码系统。 $_SESSION 变量通过 AJAX 调用传递,因此验证码可以与 AJAX 一起使用。

这是 PHP 邮件程序最基本的形式...

$to = "[email protected]";
    $subject = "Website inquiry from ".$_POST['name'];
    $content = "
    <html>
        <head>
            <title></title>
        </head>
    <body>
    <p>
    Name: ".$_POST['name']."<br />Phone: ".$_POST['phone'].'<br />Email: '.$_POST['email'].'<br />Referred By: '.$_POST['referred'].'<br /><br />'.nl2br($_POST['message']).
    '
    </body>
    </html>
    ';

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    $headers .= 'From: '.$_POST["email"];


    mail($to,$subject,$content,$headers);
    echo "<font color=\"#0c0\">Your message has been sent.</font>";

Yup server side.. I use a combination of PHP and AJAX to achieve this, with a CAPTCHA system integrated in. $_SESSION variables pass through AJAX calls, hence the CAPTCHA works with AJAX.

Here's the most basic form of a PHP mailer...

$to = "[email protected]";
    $subject = "Website inquiry from ".$_POST['name'];
    $content = "
    <html>
        <head>
            <title></title>
        </head>
    <body>
    <p>
    Name: ".$_POST['name']."<br />Phone: ".$_POST['phone'].'<br />Email: '.$_POST['email'].'<br />Referred By: '.$_POST['referred'].'<br /><br />'.nl2br($_POST['message']).
    '
    </body>
    </html>
    ';

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    $headers .= 'From: '.$_POST["email"];


    mail($to,$subject,$content,$headers);
    echo "<font color=\"#0c0\">Your message has been sent.</font>";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文