HOW TO send email with a form submission result?

Discuss everything related to FormBuilder. All versions. Any questions related to the FormBuilder developing or using should be posted to this forum.

Moderators: alexandrleonenko, goas

goas
Newbie
Newbie
Posts: 9
Joined: Apr 23rd, '12, 11:26

HOW TO send email with a form submission result?

Postby goas » Oct 17th, '13, 10:36

In order to send emails with form results:
1. Set letter properties for your form:

Code: Select all

$form->SendResultAsEmail() //you allow the results to be sent
     ->AddEmailAddress("first@email.com", "second@email.com") // you set the emails where to send them to
     ->AddEmailContent("Date: ".date("Y-m-d") // you can add any kind of content to your letter
     ->SetEmailSubject("Form result")); // you can set a subject for letter

2. Yet more you can set a 'from' header for your letter:

Code: Select all

$form->getEmail() // you will get letter object
->SetFrom($from); // set a 'from' header

3. If you have problems sending letter first of all make sure your mailing server is set. The mailing function in FormBuilder can produce an error. By default error productions is disabled. To set it on, find file <i>/lib/classes/basic/FB_Letter.php</i> then find function <i>private function _SendLetter() (line 122) </i> and remove a '@' sign in line 126

Code: Select all

return @mail($this->_GetLetterTo(), $this->letterSubject, $this->content, $headers);

so you will get

Code: Select all

return @mail($this->_GetLetterTo(), $this->letterSubject, $this->content, $headers);

This will let you see all errors from mail() function.

Return to “ApPHP FormBuilder {developers/users}”