2016-04-11 20 views
1

localhost'dan phalcon ile e-posta göndermeyi deniyorum ama çalışmıyor. Bu şekilde codeigniter'da test ettim ve düzgün çalışıyor ama phalcon'da faild. mt yanlış? Lütfen! im bunu şöyle anladım: İlk uygulama kitaplığı için https://github.com/asyamedya/phalcon-phpmailer'dan kütüphaneyi yapıştır. o zaman- yük kütüphanesiDir in loader.php.Phalcon'dan posta gönder

[controller] 
    public function feedsAction() 
{ 

    //require 'http://localhost/demo/app/library/PHPMailerAutoload.php'; 

    $mail = new PHPMailer; 

    //$mail->SMTPDebug = 3;        // Enable verbose debug output 

    $mail->isSMTP();          // Set mailer to use SMTP 
    $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers 
    $mail->SMTPAuth = true;        // Enable SMTP authentication 
    $mail->Username = '[email protected]';     // SMTP username 
    $mail->Password = 'secret';       // SMTP password 
    $mail->SMTPSecure = 'tls';       // Enable TLS encryption, `ssl` also accepted 
    $mail->Port = 587;         // TCP port to connect to 

    $mail->setFrom('[email protected]', 'Mailer'); 
    $mail->addAddress('[email protected]', 'Joe User');  // Add a recipient 
    $mail->addAddress('[email protected]');    // Name is optional 
    $mail->addReplyTo('[email protected]', 'Information'); 
    $mail->addCC('[email protected]'); 
    $mail->addBCC('[email protected]'); 

    $mail->addAttachment('/var/tmp/file.tar.gz');   // Add attachments 
    $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name 
    $mail->isHTML(true);         // Set email format to HTML 

    $mail->Subject = 'Here is the subject'; 
    $mail->Body = 'This is the HTML message body <b>in bold!</b>'; 
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; 

    if(!$mail->send()) { 
     echo 'Message could not be sent.'; 
     echo 'Mailer Error: ' . $mail->ErrorInfo; 
    } else { 
     echo 'Message has been sent'; 
    } 
} 
+0

Sorunuzu orijinalden oldukça fazla değiştirdiniz. Gelecekte, onu değiştirmek yerine yeni bir soru açmalısın. – Timothy

cevap

-1

Phalcon'da posta bileşeni yok, posta için harici bir kütüphane kullanmalısınız.

swiftmailer ve phpmailer dahil olmak üzere birçok seçenek arasından seçim yapabilirsiniz. PHP sürümü 4.2.3 fo olarak manual göre

+0

yergo - im test etmek için localhost, xampp, php-5.6.19. xampp herhangi bir yerleşik posta bileşeni var mı? xampp sürüm 1.7'de bu fonksiyon mükemmel çalışıyor. ve phalcon – munaz

+0

için hangi bileşeni önerdiğimi bir öneride bulunursam https://github.com/asyamedya/phalcon-phpmailer adresinden kütüphaneyi kullanırsam nasıl yapılandırabilirim lütfen çalışma örneğini ver. Thanx – munaz

+0

Repo'nun README.md dosyasına bakın. Bu, – Timothy

0

:

The additional_parameters parameter is disabled in safe_mode and the mail() function will expose a warning message and return FALSE when used.

Yani sizin kod:

$postMail = mail($to, $subject, $msg, $headers, "-f $from"); 

muhtemelen else durumda içine boğulur false değeri ile sona eriyor.

Not: bu bir durumda değilse, sizin inşa $headers ve $from değişkenler paylaşın.

İlgili konular