1. CodersEden Marketplace for designers and developers

Email headers in log

Discussion in 'General discussions' started by Ruslan Migory, Jan 24, 2020.

  1. Ruslan Migory

    Ruslan Migory New Member

    Joined:
    Feb 15, 2018
    Messages:
    4
    Likes Received:
    0
    S.E:
    2020-07-24 04:19:46
    L.T:
    Regular
    L.C:
    2
    Hello. I would like to see email headers and content of email that i send when i click Test template button. Probably there is a possibility to add some code to see it in application logs?
    The idea is to see a full version of email with headers and everything exactly how it sends to recipient.
     
  2. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,659
    Likes Received:
    2,472
    Isn’t it simpler to send a test campaign to mail-tester.com and check there?
     
  3. Ruslan Migory

    Ruslan Migory New Member

    Joined:
    Feb 15, 2018
    Messages:
    4
    Likes Received:
    0
    S.E:
    2020-07-24 04:19:46
    L.T:
    Regular
    L.C:
    2
    In that case i will see an email with headers already added by mailtester. And i need to see how it goes out of MailWIzz.
     
  4. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,659
    Likes Received:
    2,472
    Nope, you'll see your headers, mailtester is just the receiver.
     
  5. Ruslan Migory

    Ruslan Migory New Member

    Joined:
    Feb 15, 2018
    Messages:
    4
    Likes Received:
    0
    S.E:
    2020-07-24 04:19:46
    L.T:
    Regular
    L.C:
    2
    Here it is a chunk of headers from mailtester:
    Received: by mail-tester.com (Postfix, from userid 500)
    id 2F0859FCFC; Mon, 27 Jan 2020 14:55:27 +0100 (CET)
    Authentication-Results: mail-tester.com;
    dkim=pass (2048-bit key; unprotected) header.d=fdde.trade header.i=@fdde.trade header.b=Nd9M6Y0I;
    dkim-atps=neutral
    X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail-tester.com
    X-Spam-Level:
    X-Spam-Status: No/-0.2/5.0
    X-Spam-Test-Scores: DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,
    DKIM_VALID_EF=-0.1,HTML_MESSAGE=0.001,SPF_HELO_PASS=-0.001,
    SPF_PASS=-0.001,URIBL_BLOCKED=0.001
    X-Spam-Last-External-IP: 178.62.101.242
    X-Spam-Last-External-HELO: box.fdde.trade
    X-Spam-Last-External-rDNS: box.fdde.trade
    X-Spam-Date-of-Scan: Mon, 27 Jan 2020 14:55:27 +0100
    ------------------------------
    These headers were added by mailtester am i wrong?
     
  6. Ruslan Migory

    Ruslan Migory New Member

    Joined:
    Feb 15, 2018
    Messages:
    4
    Likes Received:
    0
    S.E:
    2020-07-24 04:19:46
    L.T:
    Regular
    L.C:
    2
    Twisted1919, so would you be able to help with logging test emails?
     
  7. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,659
    Likes Received:
    2,472
    Sure thing, i can do that :)
    There is a hook which gets triggered each time when an email goes out, you can use it to get the full source of the email and log it.
    That being said, if you create a file called init-custom.php in /apps/ folder, with this content:
    PHP:
    <?php 

    Yii
    ::app()->hooks->addAction('delivery_server_after_send_email', function($params$server$sent) {
         
    Yii::log($this->getMailer()->getEmailMessage($params), CLogger::LEVEL_ERROR);
    });
    Please beware this will log all emails that go out from the system, when you are done with your tests, delete the file.
    You can see the logs in backend > misc > application log.
     

Share This Page