This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

[v3.3] TO and BCC email addresses modifications


  1. yuniar

    For those who needs to send the result of the form to multiple email addresses and need to use BCC for the second email address and the rest, here's a simple modification to do so.

    So for example, let say you have set the destination email address of your form to these recipients:
    person1@example.com,person2@example.com,person3@example.com,person4@example.com

    This modification will send the the form result to person1@example.com (using TO) and BCC to the other addresses.

    To do this, you will need to edit "includes/helper-functions.php", around line 746 (this might change over time, but it should be somewhere near this line) you'll find this block of code:

    $s_message = Swift_Message::newInstance()
    ->setCharset('utf-8')
    ->setMaxLineLength(1000)
    ->setSubject($subject)
    ->setFrom(array($from_email => $from_name))
    ->setSender($from_email)
    ->setReturnPath($from_email)
    ->setTo($email_address)
    ->setBody($email_content, $email_content_type);

    replace the above code with this one below:

    $bcc_address = array_slice($email_address, 1);
    $to_address  = $email_address[0];
    
    $s_message = Swift_Message::newInstance()
    ->setCharset('utf-8')
    ->setMaxLineLength(1000)
    ->setSubject($subject)
    ->setFrom(array($from_email => $from_name))
    ->setSender($from_email)
    ->setReturnPath($from_email)
    ->setTo($to_address)
    ->setBcc($bcc_address)
    ->setBody($email_content, $email_content_type);

    and that's it.


    MachForm Founder

    Posted 12 years ago #
  2. accudata
    Member

    why not just make an update instead of posting a mod here? We are paying customers ya know?

    Posted 12 years ago #
  3. yuniar

    Sometime there are some features that really needed by some people but we can't simply add it into MachForm to avoid complexity. This is why the forum exist, to provide this kind of modifications. If you look closer into this forum posts, you will find lots of modifications.

    And if we include every modifications into MachForm it will become a bloated product, which we don't want. However, once a modification become popular and being used by a lot of people, most likely it will be included as part of MachForm.


    MachForm Founder

    Posted 12 years ago #
  4. accudata
    Member

    oh, okay. From reading around the forums, it seems like it took you guys around 6 years to release version 3? Why did it take so long? Is it going to be another 6 years before version 4 comes out? What is in the pipeline for version 4? Integration would be a key feature that could strike a lot of interest.

    Posted 12 years ago #
  5. NiTRoN
    Member

    just want to add that in v3.2 this is around line 740

    Posted 12 years ago #
  6. PaulWood
    Member

    Is there a way to get around the modifications being overwritten when an minor update is released?

    Posted 12 years ago #
  7. darnellsmith
    Member

    My version 3.3 looks like this and is in 2 places. When I try to modify this section of code I get a error and the interface will not even load until putting it back to the way it was. Please advise what should be changed to have multiple emails sent as BCC.

    $s_message = Swift_Message::newInstance()
    ->setCharset('utf-8')
    ->setMaxLineLength(1000)
    ->setSubject($subject)
    ->setFrom(array($from_email => $from_name))
    ->setSender($from_email)
    ->setReturnPath($from_email)
    ->setTo($user_email)
    ->setBody($email_content, 'text/html');

    Posted 12 years ago #
  8. yuniar

    darnellsmith -- on version 3.3, the code above is placed around line 746. Make sure to copy the whole code. If the problem persist, please send us your file and we'll check it.


    MachForm Founder

    Posted 12 years ago #
  9. darnellsmith
    Member

    Ok, great that worked.

    Thanks for the great support and we think your product is A1!

    Posted 12 years ago #
  10. ROYW1000
    Member

    Hi

    Rather than use the above method which would apply to all forms I assume how could I do the following and some are sent to more than one person so that bcc option wont work.

    Lets say I have 10 forms and only 2 forms I want extra people to get a BCC. Is there a way I can code in if form = 1 and 3 ten bcc this person. And if 4 = 4 bcc these people.

    Thanks
    Roy

    Posted 12 years ago #
  11. swamyg1
    Member

    I would only like to do this for particular forms as well. Can you please advise if this is possible?

    Posted 12 years ago #
  12. ROYW1000
    Member

    Hi

    Any update on this?

    Hi

    Rather than use the above method which would apply to all forms I assume how could I do the following and some are sent to more than one person so that bcc option wont work.

    Lets say I have 10 forms and only 2 forms I want extra people to get a BCC. Is there a way I can code in if form = 1 and 3 ten bcc this person. And if 4 = 4 bcc these people.

    Thanks
    Roy

    Posted 11 years ago #

RSS feed for this topic

Reply