:)
<?php
$message = "This message will directly POSTED to your GMAIL account";
$headers = "From: [email protected]";
if(mail('[email protected]', 'Example', $message, $headers))
{
echo "Text message is sent to [email protected]<BR/>";
}
else
{
echo "Not Work..";
}
?>
**Much appreciate if you can help me to fix my problem**
うーん...電子メールを送信するために、あなたが最初にGmailの設定を設定する必要がある、などのプロトコル、SMTPポート、など
私にとっては...私はCodeIgnitorフレームワークと私は私のコントローラに追加しました。このコードを使用しています:
public function send_mail() {
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465, //or 587
'smtp_timeout' => 7,
'smtp_user' => '[email protected]', //your gmail account
'smtp_pass' => 'xxx', //your gmail password
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE,
'newline' => "\r\n"
);
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$subject = $_POST["subject"];
$phone = $_POST["phone"];
$shipment_code = $_POST["shipment_code"];
$array = "Phone No: ".$phone."<br>Email: ".$email."<br>Shipment Code: ".$shipment_code."<br>Message: ".$message;
//Load email library
$this->load->library('email', $config);
$this->email->from('[email protected]');
$this->email->to('[email protected]');
$this->email->cc($email);
$this->email->subject($subject);
$this->email->message($array);
//Send mail
if($this->email->send())
$this->session->set_flashdata('email_sent',"<h2>Your email was sent successfully.</h2>");
else
$this->session->set_flashdata('email_sent',"Error in sending Email.");
echo $this->email->print_debugger();
$this->load->view('views_contactus');
}
ビューを見たい場合は、をご覧ください。 10。大きな画像で
、あなたはここに達成するために何をしたいのですか?それは個人的な趣味のプロジェクト、または有料のプロジェクト/仕事ですか?これは、メールを送信するために 'mail'のビルドを使用することは、すべてが正直であるという最悪の選択です –