WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 14.06.2023 13:55:28

ruebezahl
Member

from-Adresse aus Formular - wie?

Hallo!
Ich suche eine Möglichkeit, nicht nur die Reply-Adresse aus dem Form ins Mail zu übernehmen, sondern auch den Absender als  eMail und wenn geht auch den Namen.
Hintergrund ist, dass man so Spammer viel leichter löschen kann. Geht das irgendwie?

Offline

#2 14.06.2023 15:59:07

dev4me
Developer

Re: from-Adresse aus Formular - wie?

If I understand correctly you want the form to be sent by (from field) any fake address that someone fills in the form?

I would not advise that.
If your spamfilter blocks these mails it is likely that the sender IP is reported to one or more blacklists, resulting your IP address to be blocked as spammer.

If you really want it you can add  one line into view.php   (untested!)
find the line:

// send message by mail

after that add a line

if($replyto) $emailfrom = $replyto;

Offline

Liked by:

ruebezahl

#3 15.06.2023 13:00:46

ruebezahl
Member

Re: from-Adresse aus Formular - wie?

Thank you, this works.

But now there is a mixture of sender email and site-owner name: Siteowner<sender@email.com>, which is irritating.
How can I get the name from a field "name" as sender name: Frank Sender<sender@email.com>.

Offline

#4 15.06.2023 15:29:33

dev4me
Developer

Re: from-Adresse aus Formular - wie?

Miniform has no fields that will be there always. Any code change will therefore work on only one form!

With some effort you could create a variable from $_SESSION['form']['the_field_that_has_the_name'].
Something like (example is depending on the fieldname you used for the "Name"):

$sender_name = isset($_SESSION['form']['mf_r_name']) ? $_SESSION['form']['mf_r_name'] : WBMAILER_DEFAULT_SENDERNAME;

Next, just after the previous change the is the line with the call to the email routine.
In that line change WBMAILER_DEFAULT_SENDERNAME into $sender_name

// org
if($mf->mail ($emailfrom, $email, $subject, $emailmessage, WBMAILER_DEFAULT_SENDERNAME, $replyto)) {
// new
if($mf->mail ($emailfrom, $email, $subject, $emailmessage, $sender_name, $replyto)) {

Another (better/more simple) fix would be to change WBMAILER_DEFAULT_SENDERNAME into '' (empty string).
After that, no name will be used.

Remeber, after a future update these changes will be lost.

Offline

Liked by:

ruebezahl

Board footer

up