email not sending

Hi,

I am using SugarCRM with the following params:


$data = array(
"name" => 'Test From SugarCRM Production Environment',
"to_addrs_names" => $userEmail,
"from_addr_name" => '$senderEmail',
"from_name" => 'Test Email',
"description" => 'Test From SugarCRM Production Environment Description',
"description_html" => 'Test From SugarCRM Production Environment Description',
"type" => "outbound", // 'out' means outgoing email
"status" => "sent" // Set the status to 'sent'
);

$create_email_url = 'devdnf.sugarondemand.com/.../Emails';


It allows you to enter data in the sugar, but the email is not sending automatically.

Also, I got this error when I used the outbound email ID.

$data = array( "name" => 'Test From SugarCRM Production Environment', "to_addrs_names" => $userEmail, "from_addr_name" => '$senderEmail', "from_name" => 'Test Name', "description" => 'Test From SugarCRM Production Environment Description', "description_html" => 'Test From SugarCRM Production Environment Description', "type" => "out", "outbound_email_id"=> "1216f224-cab9-11ea-9b0b-022cc35525d8", // 'out' means outgoing email "status" => "ready" // Set the status to 'ready' );

Array ( [error] => not_authorized [error_message] => Not allowed to edit field outbound_email_id in module: Emails.)

Help me out to send an email when data is entered in the SugarCRM.

Parents
  • Hi  ,

    Where are you running this code? Inside Sugar OR Outside?

    If your attempting within Sugar is this through a Logic Hook, Scheduled Task or Other? 

    This will help me make sure I am pointing you in the right direction.

  • Hi  
    I am using PHP curl commands for this

  • Hi Rana,

    Ok, but is this from outside of Sugar or Inside?

    Example: Creating an Email Record in SugarCRM 

    Note: 

    • This does not send the email immediately
    • The Scheduler/Crons must be running for this part to work if testing locally

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    $email = BeanFactory::newBean('Emails');
    $email->name = "Test Email from SugarCRM";
    $email->description = "This is a test email";
    $email->description_html = "<p>This is a test email from SugarCRM</p>";
    $email->type = "out";
    $email->status = "ready"; // Set to "ready" for Sugar's email scheduler to send it
    $email->assigned_user_id = $current_user->id; // Assign the email to the logged-in user
    $email->from_addr_name = "sender@example.com";
    $email->to_addrs = "Recipient Name <recipient@example.com>";
    $email->save();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    There is another method for SugarPHPMailer and then if you're doing it outside of Sugar there is a method to do it via API. Let me know and I will try and help.

  • Hi  

    This is from Inside of sugar
    I am using devdnf
    live server of sugar is sending the email automatically

Reply Children