Sheikh Rahat Ali
Sheikh Rahat Ali

Reputation: 1333

How to get in code the From email address in SugarCRM

Is there any way to get the From email address via code in PHP - the address which we are using to send the email from SugarCRM.

I have tried

$phpMailer = new SugarPHPMailer();
$phpMailer->setMailerForSystem();       
print_r($phpMailer->From);

but it displays only the default value i.e. root@localhost

if i configure the From as shown below

$phpMailer->From = "[email protected]";
print_r($phpMailer->From);

it display [email protected] but when i recieve the email in my Gmail account it is received from the default configured email address of the Sugar which in our case is [email protected] i am sorry for privacy reasons i cant display it here enter image description here

If i further elaborates the received mail and check the Show Original option from the menu in Gmail (the Menu available on the right side next to the fancy arrow of Reply where the from email address is displayed in Gmail) it displays From as the defualt email address of Sugar configured by us and Return-Path: [email protected]

Any idea how to get the default configured Email address for sending emails in the Sugar via code?

Upvotes: 0

Views: 932

Answers (1)

air4x
air4x

Reputation: 5683

Try

$administration  = new Administration();
$administration->retrieveSettings();
print_r($administration->settings);

Upvotes: 1

Related Questions