TOPIC:

Email Field as Alternative From Email 12 years 2 months ago #18295

  • apcubacub's Avatar Topic Author
  • apcubacub
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 40
  • Thanks: 0
Dear Support Team,

I would like to know how I can use the Email Field in the form as the Alternative From Email, and the Name field as the Alternative From Name.

For example, I have a Feedback Form and one of the fields is Email. When they click the Submit button, instead of the usual email add from Joomla, it should be the Email entered on the form. How can I do that?

Thanks,
AL
Creating magnificent online footprints.

Please Log in or Create an account to join the conversation.

Re: Email Field as Alternative From Email 10 years 10 months ago #66957

  • ypoitras
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Hi!

Did you have an answer about that? Or you found a way to do it?

Thank you!

Yannick

Please Log in or Create an account to join the conversation.

Re: Email Field as Alternative From Email 10 years 10 months ago #67080

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10069
  • Karma: 167
  • Thanks: 809
Hi,

not out of the box, but you can use the code below in form => advanced => more options => submit pieces => end submit => check "Custom" and add & edit the code:
$this->execPieceByName('ff_InitLib');

$from = ff_getSubmit('email'); // change to name of email field
$fromname = ff_getSubmit('name'); // change to name of name field
$attachment = ff_getSubmit('upload'); // change to name of upload field if any
$subject = 'My Subject'; // Change to your preferred Email subject
$recipient = 'foo@web.com'; // Change to your admin Email address

$body = '';

foreach ($this->maildata as $data) {

  if( $data[_FF_DATA_NAME] == 'upload' )
{
   $body .= $data[_FF_DATA_TITLE].': http://www.my-domain.de/components/com_breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
} else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";

  }
}
$this->sendMail($from, $fromname, $recipient, $subject, $body, array($attachment));  // This line actually emails the form

This will send a copy of the submissions to the email address and name given in the form. You might want to disable mailbacks in your form elements, otherwise they get sent twice.

Hope this helps!

Regards,
Markus
The following user(s) said Thank You: ypoitras

Please Log in or Create an account to join the conversation.

Re: Email Field as Alternative From Email 10 years 9 months ago #67828

  • GenoPeppino
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 4
  • Thanks: 0
THANK YOU!!!

I was copying {email value: example} and putting it in the alternative field. This was causing the email not to send out.

You can cancel my ticket ...can't find the number.

Please Log in or Create an account to join the conversation.

Re: Email Field as Alternative From Email 10 years 9 months ago #68450

  • geco111
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Thanks for posting this script. Is there any way to modify the script to allow the subject to be filled by a form field before sending?

Here is what I'm hoping for:
Returning Registrations - {psc_companyname} - {psc_contactname} | {psc_email}

Please Log in or Create an account to join the conversation.

Re: Email Field as Alternative From Email 10 years 9 months ago #68633

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10069
  • Karma: 167
  • Thanks: 809
Hi,

yes there is. For your case -- given the fieldnames you mentioned are correct -- it would be this
$this->execPieceByName('ff_InitLib');

$from = ff_getSubmit('email'); // change to name of email field
$fromname = ff_getSubmit('name'); // change to name of name field
$attachment = ff_getSubmit('upload'); // change to name of upload field if any
$subject = 'Returning Registrations - '; // Change to your preferred Email subject
$recipient = 'foo@web.com'; // Change to your admin Email address

$body = '';

foreach ($this->maildata as $data) {

  if( $data[_FF_DATA_NAME] == 'upload' )
  {
   $body .= $data[_FF_DATA_TITLE].': http://www.my-domain.de/components/com_breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
  } 
  else if( $data[_FF_DATA_NAME] == 'psc_companyname' )
  {
   $subject .= $data[_FF_DATA_VALUE] . ' - ';
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
   
   } 
   else if( $data[_FF_DATA_NAME] == 'psc_contactname' )
  {
   $subject .= $data[_FF_DATA_VALUE] . ' | ';
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
   
   }else if( $data[_FF_DATA_NAME] == 'psc_email' )
  {
   $subject .= $data[_FF_DATA_VALUE];
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
   
   }else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
  }
}
$this->sendMail($from, $fromname, $recipient, $subject, $body, array($attachment));  // This line actually emails the form
The following user(s) said Thank You: geco111

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.049 seconds

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!