paulg

Adding extra email address to Agent Contact Form

17 posts in this topic

Hi

I need to add an additional email address (goes to owner of website) so each time someone submits the contact form to any agent, the owner receives a copy of the submitted form.

Is this possible?

Thank you.

Share this post


Link to post
Share on other sites

Hi

My client wants a copy of the form submitted to each agent in order to monitor sales leads.

Currently, the agent's email address is auto added to the form as recipient. I need to add one additional email address which goes to my client.

so, basically, a hidden email address in the form. Each time someone submits the form, it goes to the agent and to my client.

Hope this explains it better.

Thanks.

Share this post


Link to post
Share on other sites

Hi.

With this requirement, you can custom the component to immplement it, but you need to backup the change when you upgrade the component.

And solution is editing file /components/com_bt_property/controllers/agent.php

Find this line

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody);

change it to

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, false, 'your_client_email_here');

Enjoy it.

Kesiena likes this

Share this post


Link to post
Share on other sites

Thank you so much!

Is there a way to add the second recipient as Bcc?

Right now, both recipient email addresses are displayed when viewing the submitted form.

The second address should not be vieweable.

Share this post


Link to post
Share on other sites

Hi tronghm

I've been trying to modify the agent form to add a BCC email address. So far no luck :(

What I have researched and tried is the following. I get a blank screen when submitting form.

Can you review and tell me what I need to do differently please?

I added the last line (in bold) to the existing block here:

$app = JFactory::getApplication();

$agent = JUser::getTable();

$agent->load($app->input->getInt('agent_id'));

$name = $app->input->getString('name');

$email = $app->input->getString('email');

$content = $app->input->getString('content');

$title = $app->input->getString('title');

$phone = $app->input->getString('phone');

$mailer->addBCC('my@email.com'); - (also tried with double quotes)

Then I added this here:

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, $mailer->addBCC);

Thank you!

Share this post


Link to post
Share on other sites

Hi tronghm

I am hoping for some help on adding a Bcc email address to agent form? I have done much research on JMail but can't find a form example which shows where the additional code is required.

You provided a sample which I thank you, but it is displayed for recipient - I need it to be hidden - so a Bcc option.

Can you please help?

Thank you.

Share this post


Link to post
Share on other sites

For BCC please add one more parameter to the function

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, false, 'your_client_email_here', 'your bcc email here');

even if many email

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, false, array('cc1', 'cc2'), array('bcc1', 'bcc2' ));

Share this post


Link to post
Share on other sites

Sorry, I am confused.

With the new code, you added 'your bcc email here'

How is this hidden from recipients?

Is it just another email placeholder or is there something different in the actual email address that goes in this spot which makes it Bcc?

I just want ONE Bcc to be added (along with the agent's email which is taken from their profile.

So, what I would need is something more like this:

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, false, 'your_client_email_here', 'your bcc email here');

But how is the above different than the original version you kindly provided? Again, is the formatting of the Bcc email address different that a normal one? If so, can you provide an example of how to compose it?

Many thanks!

Share this post


Link to post
Share on other sites

You can use null like this :D

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, false, null, 'your bcc email here');

Share this post


Link to post
Share on other sites

Perfect.

Thank you!

Can you tell me which file to edit to change the way the received form info is displayed?

Below is what I wish to change. Note that "sss" is the info from the textarea field. I want to have a <br /> added so the "Sent for property: 111 Bayside Crescent" is under - not beside. And perhaps some additional CSS styling here :)

Hi Name Here !

paul gomirato [info@email.com] [] has just sent you a new message :

------------------

sssSent for property: 111 Bayside Crescent

------------------

Share this post


Link to post
Share on other sites

Hi.

Please open file /language/en-GB/en-GB.com_bt_property.ini

Find this language key

COM_BT_PROPERTY_NEW_AGENT_MESSAGE_SENT_FROM_PROPERTY

This key is content of email, with \n is new line, %s is parameter, it will be replaced by sprintf function. Please don't change or remove them.

And you can insert HTML tag here to change email content format.

Good luck.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now