2017-01-03 3 views
-2

Ich habe bereits alle Videos anschauen und lesen und die auf das Problem Frage „wie E-Mail in php von gmail mit XAMPP ?? schicken“. Es läuft aber die Ausführung in SENDMAIL.ini funktioniert nicht gutE-Mail von gmail Senden xampp mit

img Problem #1 dieses Bild gezeigt, wenn ich die Enter-Taste angeklickt, die localhost/Ex2/here.php oder der Name Ihrer PHP-Datei dauerhaft laden wenn Sie die X Taste auf der cmd sendmail.exe klicken ..

Wenn ich die X Taste auf der cmd sendmail.exe geklickt haben, wird diese Meldung auf meinem pHP-Datei img Problem #2

gezeigt

Und das ist mein Code beim Senden von E-Mails von Google Mail:

<?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** :)

+0

In größeren Bild, was wollen Sie hier erreichen? Ist es ein persönliches Hobby-Projekt oder ein bezahltes Projekt? Dies ist, weil die Verwendung der Build in "Mail" zum Senden von E-Mails die schlimmste Wahl von allen ist, um ehrlich zu sein –

Antwort

0

Nun ... für das Senden von E-Mail, müssen Sie Ihre gmail Konfiguration einzustellen zuerst, wie Protokoll, SMTP-Port usw.

für mich ... ich bin mit CodeIgnitor Rahmen und diesen Code, den ich in meinem Controller hinzugefügt haben:

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'); 

} 

Wenn Sie die Ansicht sehen möchten, dann besuchen Sie this.

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 extension = php_openssl.dll

Verwandte Themen