Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 09:23:28 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155482 Posts in 21708 Topics by 7734 Members
Latest Member: adrielkhollis4
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Form module: sender adress and differnt reply-to adress  (Read 607 times)
instantflorian
Betatester
*
Offline Offline

Posts: 802



WWW
« on: March 25, 2009, 05:00:50 PM »

Hy everybody,

I'm runnig some WB powered websites where I'm using the form module. Today the provider where much of these sites are hosted told me, that there will be changes on the mailserver configuration: script generated mails have to come from a sender adress at the same website.

That means i.e. the sender adress for the contact form at instant-design.de may no longer be the email adress the submitter entered, buthas to be whatever(at)instant-design.de.

Alright, I can change the setting "E-Mail from" of the form module to this adress. But then it becomes quite unconfortable to reply to form postings, for it is no longer possible to use the reply function of the mailclient, but the real sender adress has to be copied manually from the email body.

Even though this is something I could live with, I'm quite sure my customers surely won't. So does anybody have an idea how to change the form module that the sender adress differs from the reply-to adress in the email header?

It's quite urgent, so if there exists any solution I would be pleased to get an answer.

Regards
Florian
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #1 on: March 26, 2009, 12:00:24 AM »

Technically it should be possible to do what you want, but it means hacking into the core WB class code quite a bit.

ReplyTo is just a text header that most email clients will respect on replying.
Currently the ReplyTo header is filled with the same value used as "From:", and there is no method to use another value.

To create a real solution lots of different files needs fixing and ideally you would want to be able to fill and store a different value in the form module settings as well.

For a quick-and-dirty solution you would need to change the /framework/class.wb.php file.
On line 320 and further is shows:
Code: (class.wb.php line 320)
// set user defined from address
if ($fromaddress!='') {
    if($fromname!='') $myMail->FromName = $fromname;         // FROM-NAME
    $myMail->From = $fromaddress;                            // FROM:
    $myMail->AddReplyTo($fromaddress);                       // REPLY TO:
}

change the $mymail->From line into:
Code: (class.wb.php line 323)
   $myMail->From = "myname@mydomain.ext";                            // FROM:
to use a fixed sender.

Note: this is not tested, no guarantee, this solution is just assuming it should work like this.


Ruud

Note-2: Any future upgrades of WB will undo this hack.
« Last Edit: March 26, 2009, 12:02:10 AM by Ruud » Logged

Professional WebsiteBaker Solutions
instantflorian
Betatester
*
Offline Offline

Posts: 802



WWW
« Reply #2 on: March 26, 2009, 08:50:10 AM »

Hi Ruud,
Thank you very much for your fast and useful reply. It seems to work fine.

Florian
Logged
instantflorian
Betatester
*
Offline Offline

Posts: 802



WWW
« Reply #3 on: April 17, 2009, 02:30:20 PM »

Now it has happened... the provider switched the mail handling. And: catastrophe.

Unfortunately it is not enough to set the form sender to a fixed adress. The only way to recieve mails seems to set the -f parametre to the mail() function, e.g.
Code:
mail($empfaenger, $subject, $message, $header, "-f must-exist@unlucky-customer-of-goneo.de");

Does anybode have an idea how to add this to the wb mail handler? I have already looked at include/phpmailer/class.phpmailer.php, but simply setting the $params to the value above did not work.

Switching to SMTP mail sending does not help either. And no, I cannot simply change the provider, because this would mean to move 17 websites... argh...

I am really in big, big trouble. Would be great if anyone could help.


So this is the solution - if any other Goneo customer has the same problem:

1.) generate a php.ini file (see http://wiki.goneo.de/doku.php?id=php.ini) and change the line sendmail_path as it is described here:
http://wiki.goneo.de/doku.php?id=mailversand_php

2.) copy the php.ini in the following directories:
/account (this is necessary to send the forgot-password-mail to user)
/admin/login/forgot (this is necessary to send the forgot-password-mail to user)
and
in every directory where you have placed a form or formX page. Usual this is the pages directory; but if your contact form is placed below other pages (f. ex. "contact"), WB generates a subdirectory called contact => So you have also to copy the php.ini file into the subdirectory /pages/contact. Otherwise you will not recieve any form data mails.
(So if you restructure your wb page in several months you have to remember to move also the php.ini files if necessary...)

Lovely isn't it. If you don't have FTP access to the wb directory - bad luck...

« Last Edit: April 18, 2009, 08:15:11 AM by instantflorian » Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!