Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Cathcing Send Mails? Rate Topic   - - - - -

 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 16 November 2017 - 07:24 PM #1

How can i catch website sending mails? Any hook or function? I want to store all mail data how can i do that?

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10562 posts

Posted 17 November 2017 - 12:02 AM #2

Use the 'send_mail' php hook.

If you just want to log what is sent to customers, then you can use our Email Logging addon.

The addon will log the time, who the email was sent to and the subject in the standard system logs (Administration/Logs).


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 17 November 2017 - 08:00 AM #3

i check your addon mate. i dont want logging only i will try store all mails. ant merge with an notificaiton system



 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 17 November 2017 - 08:51 AM #4

init php

fn_register_hooks(
    'send_mail',
    'send_mail_pre'
);

func php

function fn_my_changes_send_mail($mailler)
{
    return $mailler;

}

but how i will catch this globally ? with out dispatch?



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10562 posts

Posted 17 November 2017 - 07:34 PM #5

Hooks have nothing to do with dispatch.  When the Mailer method send() is called, then the send_mail registrations are scanned and those functions are called.  You need  to read up on how hooks work in cs-cart.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 17 November 2017 - 08:01 PM #6

I read documents mate
Then this way must be correct right?

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10562 posts

Posted 17 November 2017 - 08:04 PM #7

You would get a fatal error since fn_my_changes_send_mail_pre() is not a function.  But in general, yes, you register the hook and then handle it in an structured named function.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 18 November 2017 - 05:28 AM #8

Thank you bro i understand hook usage

 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 18 November 2017 - 06:58 AM #9

stilli am getting blank page error

 

fn_register_hooks(
        'send_mail'
    );

hook registered

function fn_customer_notifications_send_mail($transport, $message, $area, $lang_code)
   {
       $body = $message->getBody();
       $from = $message->getFrom();
       $to = $message->getTo();

       fn_set_notification('N', __('notice'), $to);
   }

also added namespace use Tygh\Mailer;

 

i tyr with

function fn_customer_notifications_send_mail($message)

nothing

 

just i need catch user_id, subject, body, and to

anyone help ?



 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 18 November 2017 - 07:32 AM #10

i am getting with send_mail_pre hook but send_mail how can get this data ?



 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 18 November 2017 - 07:40 AM #11

with send_mail hoks getting

session_start(): Failed to decode session object. Session has been destroyed

error



 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 18 November 2017 - 07:45 AM #12

i get what i want values via mailer_send_post i hope its the true way



 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 275 posts

Posted 18 November 2017 - 08:01 AM #13

interestin begin worked. thank you all