Results 1 to 3 of 3

Thread: Notificaciones por email

  1. #1
    Neolobo is offline Sugar Community Member
    Join Date
    Oct 2010
    Posts
    11

    Default Notificaciones por email

    Buenas tardes

    Estoy tratando de agregar a mi modulo de Proceso_cotizacion (custom module), la forma de que si creo un valor mande un correo hasta ahora he tratado con logic_hooks y llevo esto:

    en el logic_hooks.php
    <?php

    $hook_array['before_save'] = array();
    $hook_array['before_save'][] = array(1, 'notify_user', 'custom/modules/vsc_Proceso_Cotrizacion/notify_user.php', 'notify_user', 'notify_user');
    ?>

    y en notify_user.php llevo esto

    <?php

    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class notify_user
    {

    function notify_user(&$bean, $event, $arguments)
    {
    require_once("include/SugarPHPMailer.php");
    $note_msg=new SugarPHPMailer();
    $admin = new Administration();
    $admin->retrieveSettings();
    $note_msg->Subject = 'Note: ' . $bean->name;
    $note_msg->prepForOutbound();
    $note_msg->setMailerForSystem();
    $note_msg->Body = $bean->status_ventas;
    $note_msg->From = $admin->settings['notify_fromaddress'];
    $note_msg->FromName = $admin->settings['notify_fromname'];

    $$note_msg->AddAddress('cmg@lat.com.mx')
    }
    }

    ?>

    no se cual es mi error trato de arreglarlo peor todavia no se por que no me sale nada me manda un erorr en el alrchivo en la linea 22

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Notificaciones por email

    Aqui le paso dos ejemplos de mi blog sobre este mismo tema. Uno usa plantillas y el otro no, pero los dos usan SugarPHPMailer para realizar el envio. Espero le ayuden.

    http://cheleguanaco.blogspot.com/201...ow-emails.html

    http://cheleguanaco.blogspot.com/200...-workflow.html
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  3. #3
    Neolobo is offline Sugar Community Member
    Join Date
    Oct 2010
    Posts
    11

    Default Re: Notificaciones por email

    <?php

    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class notify_user
    {

    function notify_user(&$bean, $event, $arguments)
    {
    require_once('include/SugarPHPMailer.php');
    $welcome_msg = new SugarPHPMailer();


    $status = $bean->status_ventas;

    $rcpt_name = $bean->first_name . ' ' . $bean->last_name;
    $rcpt_email = $bean->email;

    //Set RCPT address
    $welcome_msg->AddAddress($rcpt_email, $rcpt_name);

    //Setup template
    require_once('XTemplate/xtpl.php');
    $xtpl = new XTemplate('custom/modules/vsc_Proceso_Cotrizacion/WelcomeMessage.html');

    //Check the status on record
    if ($status == 'Soporte')
    {
    //Send welcome msg to Lead
    $template_name = 'Lead';

    //Assign values to variables in template
    $xtpl->assign('EMAIL_ADDY', $rcpt_email);
    $xtpl->parse($template_name);

    $welcome_msg->Body = from_html(trim($xtpl->text($template_name)));
    $welcome_msg->Subject = 'This is my test subject';
    $welcome_msg->prepForOutbound();
    $welcome_msg->setMailerForSystem();
    $welcome_msg->From = 'from_sample@example.com';
    $welcome_msg->FromName = 'Sample User';

    //Send the message, log if error occurs
    if (!$welcome_msg->Send())
    {
    $GLOBALS['log']->fatal('Error sending e-mail: ' . $welcome_msg->ErrorInfo);
    }
    }
    }

    }

    ?>

    depues delo que leei me envio esto peor no e envia nada -.-

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ¿Notificaciones al Admin ?
    By cinterpro in forum Español
    Replies: 1
    Last Post: 2011-02-23, 04:18 PM
  2. Replies: 0
    Last Post: 2009-06-04, 12:14 PM
  3. Replies: 3
    Last Post: 2009-05-22, 09:22 AM
  4. Alertas & Notificaciones
    By johnpetrusa in forum Español
    Replies: 4
    Last Post: 2008-10-09, 05:10 PM
  5. Ayuda con notificaciones
    By inguclaecheverria in forum Español
    Replies: 4
    Last Post: 2008-09-03, 03:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •