Extension talk:ContactPage

Jump to navigation Jump to search

About this board

previous talk on this page


Mshastchi (talkcontribs)

I want the emails to be sent from the email of the site (e.g info@example.com) but the email is sent from the email the user has entered in the form. This may cause the email services to consider the email as spam because the server is not the one to which the email belong.

Ammarpad (talkcontribs)

It seems this is hardcoded, so it is not allowed to be changed. However you can edit the extension files to make the desired change and maintain it.

184.103.0.165 (talkcontribs)

Can you point where to change?

Sophivorus (talkcontribs)
Reply to "SenderEmail not working"
Lefthandside (talkcontribs)

Hey all,


Here's the error:

[6381f7065ce15687504f95a5] 2020-10-03 20:26:57: Fatal exception of type "ConfigException"


Here's my config settings:

## Contact Page Extension.

wfLoadExtension( 'ContactPage' );

$wgContactConfig['default'] = array(

   'RecipientUser' => 'Contact', // Must be the name of a valid account which also has a verified e-mail-address added to it.

   'SenderName' => 'Contact Form on ' . $wgSitename, // "Contact Form on" needs to be translated

   'SenderEmail' => 'contact@lefthandside.wiki', // Defaults to $wgPasswordSender, may be changed as required

   'RequireDetails' => true, // Either "true" or "false" as required

   'IncludeIP' => true, // Either "true" or "false" as required

   'MustBeLoggedIn' => true, // Check if the user is logged in before rendering the form

   'AdditionalFields' => array(

       'Text' => array(

           'label-message' => 'emailmessage',

           'type' => 'textarea',

           'rows' => 20,

           'required' => true,  // Either "true" or "false" as required

       ),

   ),

       // Added in MW 1.26

   'DisplayFormat' => 'table',  // See HTMLForm documentation for available values.

   'RLModules' => array(),  // Resource loader modules to add to the form display page.

   'RLStyleModules' => array(),  // Resource loader CSS modules to add to the form display page.

);


Have I messed something up here?

Tlgonline (talkcontribs)

I suggest that you remove:


'DisplayFormat' => 'table',  // See HTMLForm documentation for available values.

Tlgonline (talkcontribs)

The extension.json file included in the Master version states the following defaults:


"RecipientUser": null,

"SenderEmail": null,

"SenderName": null,

"RequireDetails": false,

"IncludeIP": false,

"MustBeLoggedIn": false,

"RLModules": [],

"RLStyleModules": [],

"AdditionalFields": {

"Text": {

"label-message": "emailmessage",

"type": "textarea",

"required": true

}

Reply to "Fatal Exception"

CCS rules to 'RLStyleModules' => array()

1
91.65.129.55 (talkcontribs)

Please give an example of how to put CSS rules in 'RLStyleModules' => array()

Reply to "CCS rules to 'RLStyleModules' => array()"

E-mail address a part of the text

2
91.65.129.55 (talkcontribs)

How to make the e-mail address of the writer a part of the text

91.65.129.55 (talkcontribs)

Got a resolution for LocalSettings.php:

$wgHooks['EmailUser'][] = function ( &$address, &$from, &$subject, &$text, &$error ) {

...

 $text = $text . 'E-Mail-Adresse:: ' . $from->address;

  ...

};

Reply to "E-mail address a part of the text"

Hide the option "Send a copy of the e-mail to me"

1
91.65.129.55 (talkcontribs)

How do I hide (disable) the option "Send a copy of the e-mail to me"?

Reply to "Hide the option "Send a copy of the e-mail to me""
39.53.144.241 (talkcontribs)

How to create multiple contact pages with different fields? For example:

/index.php/Special:Contact

/index.php/Special:Contact2

Reply to "Multiple Contact Pages"

How can I add an Additional Field

3
39.53.154.161 (talkcontribs)

Hi I have just installed the ContactPage extension. I have tried to add additional fields by multiplying the below code.


'AdditionalFields' => array(

'Text' => array(

'label-message' => 'emailmessage',

'type' => 'textarea',

'rows' => 20,

'required' => true,  // Either "true" or "false" as required

),

),


However, no matter what I do I cannot achieve what I want. Can anyone provide me the example of adding a field?


Thank you in advance.

Ammarpad (talkcontribs)

You should not duplicate that completely,as it could override the default you just need to append to the array. Please post the whole code for $wgContactConfig['default'] and explain what field you want add.

39.53.154.161 (talkcontribs)

Thank you, got it working. Appending new field worked for me.


Reply to "How can I add an Additional Field"

Emails Not Delivered to RecipientUser

2
128.125.52.169 (talkcontribs)

I'm trying to send emails to the admin on the site (email confirmed), but they're not receiving it. I'm receiving the return email I requested. This is the code:


#ContactPage

wfLoadExtension( 'ContactPage' );

$wgContactConfig['default'] = array(

'RecipientUser' => 'Admin', // Must be the name of a valid account which also has a verified e-mail-address added to it.

'SenderName' => 'Contact Form on ' . $wgSitename, // "Contact Form on" needs to be translated

'SenderEmail' => null, // Defaults to $wgPasswordSender, may be changed as required

'RequireDetails' => true, // Either "true" or "false" as required

'IncludeIP' => true, // Either "true" or "false" as required

'MustBeLoggedIn' => false, // Check if the user is logged in before rendering the form

'AdditionalFields' => array(

'Text' => array(

'label-message' => 'emailmessage',

'type' => 'textarea',

'rows' => 20,

'required' => true,  // Either "true" or "false" as required

),

),

        // Added in MW 1.26

'DisplayFormat' => 'table',  // See HTMLForm documentation for available values.

'RLModules' => array(),  // Resource loader modules to add to the form display page.

'RLStyleModules' => array(),  // Resource loader CSS modules to add to the form display page.

);

$wgCaptchaTriggers['contactpage'] = true;

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $skin, &$template ) {

$contactLink = Html::element( 'a', [ 'href' => $skin->msg( 'contactpage-url' )->escaped() ],

$skin->msg( 'contactpage-label' )->text() );

$template->set( 'contact', $contactLink );

$template->data['footerlinks']['places'][] = 'contact';

return true;

};


Any ideas how to fix this?

128.125.53.209 (talkcontribs)

Update: When I submit a test email with an email such as test[at]hello.com, the admin email receives it, but when I send the test email as something [at] gmail.com or [at] outlook.com, it doesn't, even though I can get a copy of the email

Reply to "Emails Not Delivered to RecipientUser"

Requires smtp server to be open relay

2
203.15.33.148 (talkcontribs)

This extension overrides the sender email with the one provided by in the form or for the logged in user, unless your smtp server is operating as an open relay this will not work. I had to add a hook 'onEmailUser' to override this behaviour.

Sophivorus (talkcontribs)

Indeed, here is the hook I ended up using:

$wgHooks['EmailUser'][] = function ( &$address, &$from, &$subject, &$text, &$error ) {
	global $wgPasswordSender;
	$from->address = $wgPasswordSender;
};
Reply to "Requires smtp server to be open relay"
Summary by Wgkderdicke

Upcoming change of the extension possibly brings a little bit of normalization, so that no double colon appears there anymore.

Wgkderdicke (talkcontribs)

I just installed this extension here in that wiki there. That wiki runs with German language. I discoverd that the email text comes with a prefix. In German language there comes "Nachricht" (means Message), a double colon and a blank space, followed by the actual text of the email. I was wondering why there comes this odd double colon. I found out that the system message ("Nachricht:") already comes with a colon and SpecialContact.php simply adds another colon whether there is a colon yet or not (line 402 in the 1.31 version of SpecialContact.php). I changed line 402 from

$text .= "{$name}: $value\n"; to
$text .= $name.(substr($name, -1) !== ":" ? ": " : " ").$value."\n";.

That works for me.

BDavis (WMF) (talkcontribs)

This is the emailmessage message string. The English message in languages/i18n/en.json is "Message:" which includes the trailing colon as well. There appear to be a few localized versions of this message in mediawiki/core.git which do not include the trailing colon, but the overwhelming majority of the emailmessage strings do include it. It seems reasonable to actually submit a patch to the extension which assumes that no additional colon needs to be placed in the output between the value of emailmessage and the value entered by the user, or perhaps better to add a normalization step that will ensure that all label messages will end with a colon.

BDavis (WMF) (talkcontribs)
Wgkderdicke (talkcontribs)

Thanks.