Get Store Email Addresses in Magento



Suppose you are developing an extension in Magento and want to send the information to the Store owner through email, For this we need the Store email address and Store owner / Sender Name on which we have to send the email, The Store Email Address are managed from the Magento admin you can see here in the admin just by navigating to the System > Configuration > Click on the Store Email Addresses in the General Tab of the Left Sidebar. In This post I have describe how to fetch the information which is saved by the admin for the Store Email Addresses, It has 5 Section these are General Contact, Sales Representative, Customer Support, Custom Email 1 and Custom Email 2, Here are the syntax to fetch these details:

1. General Contact:
In the General Contact there are two field one is for the Name and another one is for the email here is the syntax to fetch these details: it works on this pattern Mage::getStoreConfig(‘SectionName/GroupName/FieldName’)

/* Sender Email */
Mage::getStoreConfig('trans_email/ident_general/email'); //Here is the SectionName : trans_email, GroupName: ident_general and FieldName: email
/* Sender Name */
Mage::getStoreConfig('trans_email/ident_general/name'); //Here is the SectionName : trans_email, GroupName: ident_general and FieldName: name

2. Sales Representative:
In the Sales Representative there are two field one is for the Name and another one is for the email here is the syntax to fetch these details: it works on this pattern Mage::getStoreConfig(‘SectionName/GroupName/FieldName’)

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_sales/name'); //Here is the SectionName : trans_email, GroupName: ident_sales and FieldName: name
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_sales/email'); //Here is the SectionName : trans_email, GroupName: ident_sales and FieldName: email

3. Customer Support:
In the Customer Support there are two field one is for the Name and another one is for the email here is the syntax to fetch these details: it works on this pattern Mage::getStoreConfig(‘SectionName/GroupName/FieldName’)

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_support/name'); //Here is the SectionName : trans_email, GroupName: ident_support and FieldName: name
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_support/email'); //Here is the SectionName : trans_email, GroupName: ident_support and FieldName: email

4. Custom Email 1:
In the Custom Email 1 there are two field one is for the Name and another one is for the email here is the syntax to fetch these details: it works on this pattern Mage::getStoreConfig(‘SectionName/GroupName/FieldName’)

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_custom1/name'); //Here is the SectionName : trans_email, GroupName: ident_custom1 and FieldName: name
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_custom1/email'); //Here is the SectionName : trans_email, GroupName: ident_custom1 and FieldName: email

5. Custom Email 2:
In the Custom Email 2 there are two field one is for the Name and another one is for the email here is the syntax to fetch these details: it works on this pattern Mage::getStoreConfig(‘SectionName/GroupName/FieldName’)

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_custom2/name'); //Here is the SectionName : trans_email, GroupName: ident_custom2 and FieldName: name
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_custom2/email'); //Here is the SectionName : trans_email, GroupName: ident_custom2 and FieldName: email

Hope it helps and you enjoyed reading, if you need the professional Magento Development we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.