2017-01-03 5 views
-2

を使用してGmailからメールを送信します。これは、実行されるのに、SENDMAIL.iniでの実行は、私は/ here.php入力ボタンは、localhost/EX2をクリックしたときに、このPICは、示さうまくは、私はすでに「<strong>XAMPP</strong>を使用して<strong>Gmailの</strong>から<strong>PHP</strong>に<strong>メール</strong>を送信する方法??」すべての動画と問題に関連する質問を見て、読んでXAMPP

img Problem #1 機能していないか、あなたのPHPファイルの名前が永久的にロードされます私はsendmail.exeのCMDにXボタンをクリックすると、あなたは... sendmail.exeのCMDに

Xボタンをクリックし、このメッセージは、私のPHPファイルにimg Problem #2

を示しますしない限り、これは私のコードですGmailからメールを送信中:

+0

、あなたはここに達成するために何をしたいのですか?それは個人的な趣味のプロジェクト、または有料のプロジェクト/仕事ですか?これは、メールを送信するために 'mail'のビルドを使用することは、すべてが正直であるという最悪の選択です –

答えて

0

:)

<?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。大きな画像で

0

php.iniの

SMTP=smtp.gmail.com 
smtp_port=465 
sendmail_from = [email protected] 
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" 

sendmail.ini

smtp_server=smtp.gmail.com 
smtp_port=465 
error_logfile=error.log 
debug_logfile=debug.log 
[email protected] 
auth_password=YOUR_MAIL_PASS 
[email protected] 

php.iniの 拡張子= php_openssl.dll

関連する問題

 関連する問題