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

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

[closed] NOTIFICATION_MAIL_FROM


  1. richardmay
    Member

    Is it possible to for Mach Form to put a email field as the FROM in the notification field and put a name in the NAME field of the notification email?

    This way I can just hit reply when viewing the notification.

    Posted 16 years ago #
  2. yuniar

    Hmm.. ok, let say you have a form with id = 7 and the following field id:

    Email --> element_2
    Name --> element_3_1

    (view the HTML source of your form to get those ids)

    Edit your includes/helper-functions.php, search around line 448 for this code:

    $mail->Host     = "127.0.0.1";
    $mail->Mailer   = "mail";
    $mail->CharSet  = 'UTF-8';


    Now, right above those code, add this code:

    if($form_id == 7){
    	if(!empty($table_data['element_2'])){
    		$mail->From = $table_data['element_2'];
    	}
    
    	if(!empty($table_data['element_3_1'])){
    		$mail->FromName = $table_data['element_3_1'];
    	}
    }


    That would do it. Make sure to adjust those id numbers.


    MachForm Founder

    Posted 16 years ago #
  3. richardmay
    Member

    That works! Thanks.

    Posted 16 years ago #
  4. richardmay
    Member

    Let's make this a bit more complex :)

    I am using MachForm to get leads for event bookings and my replies to the leads invariably say: "Event: dd-mm-yyyy". This helps me easly track conversations regarding a lead or a booking.

    I can figure out how to add a field to the subject line but how would I add the three fields from the date? Again, this would allow me to simply reply to the lead with the information needed without writing a new email.

    Thanks.

    Posted 16 years ago #
  5. yuniar

    It's pretty simple actually. If you take a look into your form HTML source, the three fields would have id such as these:

    - element_4_1
    - element_4_2
    - element_4_3

    From helper-functions.php file, you can access them all together by using this variable: $table_data['element_4']


    MachForm Founder

    Posted 16 years ago #
  6. richardmay
    Member

    duh!

    How do add the text prefix "Event:"?

    I can get just the text or just the date... but not both.

    Posted 16 years ago #
  7. yuniar

    like this:

    $mail->Subject = "Event: {$table_data['element_4']}";


    MachForm Founder

    Posted 16 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.