簡體   English   中英

從網站發送文本到電子郵件

[英]send text from website to email

嗨,我想在我的網站中添加字段,使人們將郵件直接發送給我,這是我的代碼

<form action="" method="post" name="data_table">
          Contact Us
          <input type="text" name="name">
          <input type="text" name="phone">
          <input type="text" name="email">
        <textarea name="message""></textarea>
        <input type="submit" name="send">
</form>
<?php
$from = '<@gmail.com>'; //change this to your email address
$to = '<@yahoo.com>'; // change to address
$subject = 'Insert subject here'; // subject of mail
$body = "Hello world! this is the content of the email"; //content of mail
$headers = array(
    'From' => $from,
    'To' => $to,
    'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
        'host' => 'ssl://smtp.gmail.com',
        'port' => '465',
        'auth' => true,
        'username' => '@gmail.com', //your gmail account
        'password' => 'snip' // your password
    ));

// Send the mail
$mail = $smtp->send($to, $headers, $body);
?>

並出現此錯誤

致命錯誤:在第322行的/var/www/html/ISPGroup-Website/index.php中找不到類“郵件”

該網站上傳到服務器上后如何修復? 以及如何更改stmp詳細信息? 還有沒有其他方法可以使人們將郵件從我的網站直接發送到我的電子郵件,謝謝

抱歉,我重新更新我的帖子,

嘗試致電之前

use Mail;

或檢查php.ini中的包含路徑

或檢查按服務器根目錄安裝

梨安裝郵件

梨安裝pear / Net_SMTP

梨安裝pear / Auth_SASL

PEAR安裝指南: http : //pear.php.net/manual/en/installation.checking.php

或嘗試使用phpmailer作為替代

嘗試包括Mail.php

require('../php/Mail.php');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM