Ergebnis 1 bis 6 von 6

Thema: notification_center mails verschicken

  1. #1
    Alter Contao-Hase Avatar von kmielke
    Registriert seit
    21.06.2009.
    Beiträge
    1.173

    Standard notification_center mails verschicken

    Hallo,

    ich versuche mit dem notification_center mails zu versenden. IN meinem Modul kann man eine Benachrichtigung wählen.

    PHP-Code:
            // Id der Benachrichtigung
            
    $ncid $this->regform;

            
    // Get the input parameter
            
    $email = (\Input::get('email')) ? \Input::get('email') : 0;

            
    // Jetzt noch die notification_center mais raus
            
    $objNotification = \NotificationCenter\Model\Notification::findByPk($ncid);
            if (
    null !== $objNotification) {
                
    $objNotification->send(array($email));
            } 
    Es gibt keine Fehlermeldung oder so. Es wird aber auch nichts verschickt.
    Im Contao System-Log erscheint das.

    PHP-Code:
    [16.05.2016 15:59Version 3 of record "tl_nc_message.id=4" has been created (parent recordstl_nc_notification.id=4
    Hat da jemand einen Tipp für mich?

    Danke
    Gruß Kester

    Kein Support via PN ohne vorherige Absprache.

  2. #2
    Contao-Nutzer Avatar von benzin
    Registriert seit
    06.02.2016.
    Ort
    Essen/Düsseldorf, NRW
    Beiträge
    84
    Partner-ID
    11060

    Standard

    Zitat Zitat von kmielke Beitrag anzeigen
    PHP-Code:
    [16.05.2016 15:59Version 3 of record "tl_nc_message.id=4" has been created (parent recordstl_nc_notification.id=4
    Dieser Log-Eintrag ist auf jeden Fall keine Folge des Versuchs, die Nachricht zu verschicken, sondern nur die Info, dass eine neue Version einer Nachricht gespeichert wurde.

    Von welchem Typ ist denn deine Benachrichtigung? Wenn es eine eigene ist: Poste mal deine Config des Types. Das Problem liegt vermutlich in der Übergabe der Empfänger-E-Mail-Adresse:

    Zitat Zitat von kmielke Beitrag anzeigen
    PHP-Code:
    (...)
            if (
    null !== $objNotification) {
                
    $objNotification->send(array($email));
            } 
    Geändert von benzin (17.05.2016 um 13:10 Uhr)

  3. #3
    Alter Contao-Hase Avatar von kmielke
    Registriert seit
    21.06.2009.
    Beiträge
    1.173

    Standard

    Hi,

    keine Ahnung, von welchem Typ.

    Habe einfach eine Benachrichtigung angelegt, und die will ich nutzen. Habe aber mal in die config.php geschaut, und gehe davon aus, dass ich den Standard-Contao Typ nutzen will.

    PHP-Code:
             'contao' => array(
                 
    'core_form' => array(
                     
    'recipients'           => array('admin_email''form_*'),
                     
    'email_subject'        => array('form_*''formconfig_*''admin_email'),
                     
    'email_text'           => array('form_*''formconfig_*''raw_data''admin_email'),
                     
    'email_html'           => array('form_*''formconfig_*''raw_data''admin_email'),
                     
    'file_name'            => array('form_*''formconfig_*''admin_email'),
                     
    'file_content'         => array('form_*''formconfig_*''admin_email'),
                     
    'email_sender_name'    => array('admin_email''form_*'),
                     
    'email_sender_address' => array('admin_email''form_*'),
                     
    'email_recipient_cc'   => array('admin_email''form_*'),
                     
    'email_recipient_bcc'  => array('admin_email''form_*'),
                     
    'email_replyTo'        => array('admin_email''form_*'),
                     
    'attachment_tokens'    => array('form_*'),
                 ), 
    Ich muss mir das also noch mal ansehen. Wird also noch was dauern, bis ich damit durch bin.

    Gruß Kester
    Gruß Kester

    Kein Support via PN ohne vorherige Absprache.

  4. #4
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.166
    Partner-ID
    10107

    Standard

    Hast du schon überprüft ob hier
    PHP-Code:
    $objNotification = \NotificationCenter\Model\Notification::findByPk($ncid); 
    $objNotification nicht NULL ist?

  5. #5
    Alter Contao-Hase Avatar von kmielke
    Registriert seit
    21.06.2009.
    Beiträge
    1.173

    Standard

    Ja, ist was da...
    Ich gehe davon aus, das meine config noch nicht stimmt.
    Gruß Kester

    Kein Support via PN ohne vorherige Absprache.

  6. #6
    Contao-Nutzer Avatar von benzin
    Registriert seit
    06.02.2016.
    Ort
    Essen/Düsseldorf, NRW
    Beiträge
    84
    Partner-ID
    11060

    Standard

    Zitat Zitat von kmielke Beitrag anzeigen
    Hi,

    PHP-Code:
             'contao' => array(
                 
    'core_form' => array(
                     
    'recipients'           => array('admin_email''form_*'),
                     
    'email_subject'        => array('form_*''formconfig_*''admin_email'),
                     
    'email_text'           => array('form_*''formconfig_*''raw_data''admin_email'),
                     
    'email_html'           => array('form_*''formconfig_*''raw_data''admin_email'),
                     
    'file_name'            => array('form_*''formconfig_*''admin_email'),
                     
    'file_content'         => array('form_*''formconfig_*''admin_email'),
                     
    'email_sender_name'    => array('admin_email''form_*'),
                     
    'email_sender_address' => array('admin_email''form_*'),
                     
    'email_recipient_cc'   => array('admin_email''form_*'),
                     
    'email_recipient_bcc'  => array('admin_email''form_*'),
                     
    'email_replyTo'        => array('admin_email''form_*'),
                     
    'attachment_tokens'    => array('form_*'),
                 ), 
    Das ist der Benachrichtigungstyp, den das Notification-Center für Formulare mitbringt. Wenn du mithilfe des Formuargenerators ein Formular erstellst und dort eine Benachrichtigung aktivierst, wird die oben genannte Config gezogen. Der Config kannst du entnehmen, dass für das Feld 'recipient' entweder die Admin-Mail verwendet werden kann, oder aber ein beliebiger Token 'form_*' erwartet wird.

    Du möchtest eine Benachrichtigung aus einem eigenen Modul verschicken, oder? Dann versuch mal folgendes: Im Backend beim Empfänger den Token ##form_email## einsetzen und dann deinen Code wie folgt abändern:

    PHP-Code:
    if (null !== $objNotification) { 
                
    $objNotification->send(array('form_email' => $email)); 
            } 
    Beste Grüße
    benzin

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •