2013-09-23 4 views
5

का उपयोग करने के लिए सिम्फनी 2/स्विफ्टमेलर को कॉन्फ़िगर करें मैं वर्तमान में मेल के माध्यम से सबमिट किए गए फ़ॉर्म की सामग्री भेजने के लिए सिम्फनी 2/स्विफ्टमेलर प्राप्त करने का प्रयास कर रहा हूं। मेरे parameters.yml शामिल निम्नलिखित:"sendmail -t"

mailer_transport: sendmail 
mailer_host: ~ 
mailer_user: ~ 
mailer_password: ~ 

के बाद से मेरे सर्वर पर sendmail संस्करण -bs विकल्प, Swiftmailer डिफ़ॉल्ट रूप से उपयोग करने के लिए लगता है जो समर्थन नहीं करता, मैं एक तरह से Symfony2/Swiftmailer बताने के लिए उपयोग करने के लिए खोजने के लिए इसके बजाय sendmail -tSwift_Transport_SendmailTransport इसका समर्थन करता प्रतीत होता है, लेकिन स्विफ्टमेलरबंडल के लिए एक समान कॉन्फ़िगरेशन विकल्प प्रतीत नहीं होता है।

मैं स्विफ्टमेलर को sendmail -t (कॉन्फ़िगरेशन के माध्यम से प्राथमिकता) का उपयोग करने के लिए कैसे कहूं?

संपादित करें 2: अभी के लिए, मैं

$message = \Swift_Message::newInstance() 
      […]; 

$transport = $this->get('swiftmailer.mailer.default.transport.real'); 
if ($transport instanceof \Swift_Transport_SendmailTransport) { 
    $transport->setCommand('/usr/sbin/sendmail -t'); 
} 

$this->get('mailer')->send($message); 

उपयोग कर रहा हूँ मैं अभी भी सोच रहा हूँ, हालांकि यह करने के लिए एक बेहतर तरीका है।

उत्तर

6

यह विन्यास काम करना चाहिए:

यहाँ प्रलेखन है।

mailer_transport: sendmail 
mailer_host: /usr/bin/sendmail # wherever your mail is 
#mailer_user: ~ 
#mailer_password: ~ 

अगर वहाँ अभी भी समस्या है,

A. check who are sending mail to [email protected] 
    1. console - check your permission to access sendmail 
    2. web - check web user like wwww-data can access sendmail 
B. check your mail log /var/log/maillog 
    When Symfony Swiftmailer send, 
    1. mail log has not been processed, then PHP side problem. 
    2. else if: send to outlook 
     it is TLS handshake problem, it might be from outlook tls handshake. 
     FYI, sendmail TLS is not working with outlook well. 

     add next line to /etc/mail/access 
     Try_TLS:wxy.com    NO 
    3. else: 
     Sorry, google with mail log error messages again . 
5

बस यह बहुत ही इस मुद्दे पर दिन बिताया।

मैं बात इस तरह का के लिए सीधे विन्यास का उपयोग कर पसंद करते हैं, और मैं इस काम करने के लिए मिला:

# app/config/services.yml 
services: 
    swiftmailer.mailer.default.transport: 
    class:  Swift_SendmailTransport 
    arguments: ['/usr/sbin/sendmail -t'] 
संबंधित मुद्दे