[BonusForms] Cannot send mail *SOLVED*

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

[BonusForms] Cannot send mail *SOLVED*

Postby mbootsman » Thu Aug 18, 2011 10:37 am

I have installed Bonusforms - nice extension!.
After including a form on a page, and editing the form action 'mail', I tested the form. Filled in all the required fields, clicked submit button, but then I get the message that mail cannot be sent...

Looking in the log, I don't see any weird things..

Do I need a mail template? If yes, how do I make one?
Last edited by mbootsman on Fri Aug 19, 2011 9:13 am, edited 1 time in total.
mbootsman
 
Posts: 89
Joined: Tue Apr 29, 2008 7:09 am

Re: [BonusForms] Cannot send mail

Postby mbootsman » Fri Aug 19, 2011 8:08 am

Anyone with a clue, how to debug this? (and of course how to solve it?)
Thanks in advance.
mbootsman
 
Posts: 89
Joined: Tue Apr 29, 2008 7:09 am

Re: [BonusForms] Cannot send mail

Postby mbootsman » Fri Aug 19, 2011 8:47 am

I'll start debugging then...

Edit file hook_bonusforums.php.

On this line the e-mail is sent:
Code: Select all
$ret = mail($to, $subject, $message, $headers, $additional_parameters);


The mailer returns false, so there must be something wrong there.
Stripping the $headers and $additional_parameters from the mail statement does the trick. But why?
Leaving the $additional_parameters in the statement send an e-mail, so the $headers variable is the cause. Let's see what data I have in my $headers variable.

When I echo the $headers variable I see this
Code: Select all
From: lastname_value_of_form <email_value_of_form>
Reply-to: email_value_of_form
Return-path: <email_value_of_form>
Bcc:


When I clear the $headers variable, the mail sends...
What is wrong with my $headers?
mbootsman
 
Posts: 89
Joined: Tue Apr 29, 2008 7:09 am

Re: [BonusForms] Cannot send mail

Postby hansfn » Fri Aug 19, 2011 8:54 am

I'm happy to see that you started the debugging yourself - saved me some typing ;-)

It could be the line endings, it could be the empty Bcc, it could be ... It really depends on what e-mail server PHP is talking to. Test the line endings first - change $this->CRLF = "\r\n"; to just $this->CRLF = "\n"; If it didn't help remove the BCC and so on ...
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: [BonusForms] Cannot send mail

Postby mbootsman » Fri Aug 19, 2011 8:57 am

Hmm,

looks like I found it.
The names specified in the mail action configuration should be encapsulated in double quotes (").
mbootsman
 
Posts: 89
Joined: Tue Apr 29, 2008 7:09 am


Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 5 guests

cron