jeronimo
25th of November 2007 (Sun), 10:15
Hello all
I finaly did it; finished an e-mail script that fits EE2 AND is multilangual;
Please feel free to report buggs or other comment in this thread
Underneat I will explain how things work.
First I'll explain the script
It's just an ordinairy mail form that contains CAPTCHA;
Only the visitor gets ALSO an auto-reply with their text. (you can disable this.
;)I realy would apriciate that you DO NOT delete the copyright code in the source code ;)
On my site I put the .zip file that includes 3 files
1; the CAPTCHA generator ( wsp_get_captha.php )
2; the mail form ( mail.php )
3; code you have to add to you languages/ x x x / global.php file (global.txt)
http://www.landmarks.nl/EEmail_form.zip
UPLOAD mail.php and wsp_get_captha.php to the root of EE.
Be sure to select the propper stylesheet for custom A in the admin panel
(go to admin panel; then go to styles
scroll down a bit till you find Custom Templates
Then in the line custom A place
templates/pages/ee_2_default_UDM/custom/content_a.php if you use the UDM4 menu; else
templates/pages/ee_2_default/custom/content_a.php should be placed there
First let me stat with the CAPTCHA generator
On line 6 you'll see
/////////// Settings ///////////
$text = '123456789'; // captcha chars
$bg_color = "#EEEEEE"; // background color
$font_color = "#003366"; // font color
$filling = true; // When this parameter is set to true, filling lines will be added.
$fill_color = "#6699CC"; // filling color
/////////// End Settings ///////////Most of the settings you don't have to change;
$text is the text that is shown in the CAPTCHA, the more different characters, the more diffuclt the CAPTCHA. I only use numbers, but you can also use letters (lowercase as UPPERCASE)
The rest speaks for it self.
DO NOT CHANGE CODE OTHER THEN THE ABOVE, THE CAPTCHA MY STOP WORKING
This file (wsp_get_captha.php) needs to be in the same directory as the mail.php.
Second; the mail form
The mail form code is a modified verion of the webspamprotect form (WebSpamProtect.com (http://webspamprotect.com)) and is placed in the EE2 empty.php file
The code is pretty long and can be found in the mail.php file from line 89 till 371. There are only two parameters you have to set in the form
on line 181 of the mail.php file.
The code looks like
$YourEmail = "yourmail@yoursite.com"; // Add your e-mail hereHere you fill in the adres where your visitors should send the mail to.
Then on line 359 and 360 you have to set an no reply mail adres
$headers = "From: noreply@yoursite.com\r\n";
$headers .= "Reply-To: noreply@yoursite.com\r\n";You can also delete the folowing code, but then no longer an confirmation message is send
//build conformation e-mail
$body = "$ty_text $name\n\n";
$body .= "$cnt_shrt_text; $email; \n\n";
$body .= "$y_send_text; \n\n";
$body .= "$message\n\n\n\n\n\n";
$body .= "$auto_res_text";
$Subject = "Auto reply on $Subj2 from Landmarks.nl";
$headers = "From: noreply@yoursite.com\r\n";
$headers .= "Reply-To: noreply@yoursite.com\r\n";
$headers .= "X-Mailer: PHP\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
@mail($email, $Subject, $body, $headers);THIRD; after editing al the above, you have to add some lines to the global.php files in your language dir's
//mail form text
$translated["Contact_form"] = "Contact form";
$translated["mail_text"] = "If you have any questions or comments, you can send them with this form. Please make sure your indications are clear. <br /><br /><br />You must fill in all fields.<br />";
$translated["name_er"] = "fill in your name";
$translated["subj_er"] = "fill in a subject";
$translated["mail_er"] = "fill in a email adress";
$translated["mail_er2"] = "fill in a vallid email adress";
$translated["mess_bl"] = "fill in a message";
$translated["thnk_you"] = "Than you for your email";
$translated["cnt_shrt"] = "We will contact you as soon as possible on the folowing e-mail adres";
$translated["y_send"] = "You send us the folowing message";
$translated["auto_res"] = "WHATCH OUT: This is an automaticly generated email massage, do not answer on this.";
$translated["mail_t_text"] = "Your message";
$translated["capt_code"] = "Confirmation code";
$translated["captcha"] = "Fill in the confirmation code";
$translated["capt_err"] = "fill in the right code";
$translated["name"] = "Name";
$translated["email"] = "Email";
$translated["subject"] = "Subject";
$translated["send"] = "Send your message";These text lines are displayed in the mail form. You have to translate the text yourself (offcourse ;))
---------------------------------------------------------------
An working example of the form is on my site
http://www.landmarks.nl/mail.php?ee_lang=eng
If one sends the next lines from the form;
Name; Jeroen Roelofsen
E-mail adres; mail@mail.com
Subject; Mailform
Your message; The text I submitted
Then body of the message that you'll get in your mail box looks like;
Name: Jeroen Roelofsen
E-mail adres: mail@mail.com
eng:
IP: XXX.XXX.XXX.XXX
Your message:
The text I submitted
Ass you can see, there are 2 extra lines;
eng; means the form is submitted with the english language
the ip is the ip adress of the visitor
You can direcly reply on this mail to you visitor.
---------------------------------------------------------
The visitor itselfs gets the message;
Thank you for your email Jeroen Roelofsen
We will contact you as soon as possible on the folowing e-mail adres; mail@mail.com;
You send us the folowing message;
the text i submitted
WHATCH OUT: This is an automaticly generated email massage, do not answer on this.
And if the visitor reply's to this message, the mail will be sent to the noreply adres you've added
-------------------------------------
Hope you all like the script.
Please reports bugs or changes in this thread
I finaly did it; finished an e-mail script that fits EE2 AND is multilangual;
Please feel free to report buggs or other comment in this thread
Underneat I will explain how things work.
First I'll explain the script
It's just an ordinairy mail form that contains CAPTCHA;
Only the visitor gets ALSO an auto-reply with their text. (you can disable this.
;)I realy would apriciate that you DO NOT delete the copyright code in the source code ;)
On my site I put the .zip file that includes 3 files
1; the CAPTCHA generator ( wsp_get_captha.php )
2; the mail form ( mail.php )
3; code you have to add to you languages/ x x x / global.php file (global.txt)
http://www.landmarks.nl/EEmail_form.zip
UPLOAD mail.php and wsp_get_captha.php to the root of EE.
Be sure to select the propper stylesheet for custom A in the admin panel
(go to admin panel; then go to styles
scroll down a bit till you find Custom Templates
Then in the line custom A place
templates/pages/ee_2_default_UDM/custom/content_a.php if you use the UDM4 menu; else
templates/pages/ee_2_default/custom/content_a.php should be placed there
First let me stat with the CAPTCHA generator
On line 6 you'll see
/////////// Settings ///////////
$text = '123456789'; // captcha chars
$bg_color = "#EEEEEE"; // background color
$font_color = "#003366"; // font color
$filling = true; // When this parameter is set to true, filling lines will be added.
$fill_color = "#6699CC"; // filling color
/////////// End Settings ///////////Most of the settings you don't have to change;
$text is the text that is shown in the CAPTCHA, the more different characters, the more diffuclt the CAPTCHA. I only use numbers, but you can also use letters (lowercase as UPPERCASE)
The rest speaks for it self.
DO NOT CHANGE CODE OTHER THEN THE ABOVE, THE CAPTCHA MY STOP WORKING
This file (wsp_get_captha.php) needs to be in the same directory as the mail.php.
Second; the mail form
The mail form code is a modified verion of the webspamprotect form (WebSpamProtect.com (http://webspamprotect.com)) and is placed in the EE2 empty.php file
The code is pretty long and can be found in the mail.php file from line 89 till 371. There are only two parameters you have to set in the form
on line 181 of the mail.php file.
The code looks like
$YourEmail = "yourmail@yoursite.com"; // Add your e-mail hereHere you fill in the adres where your visitors should send the mail to.
Then on line 359 and 360 you have to set an no reply mail adres
$headers = "From: noreply@yoursite.com\r\n";
$headers .= "Reply-To: noreply@yoursite.com\r\n";You can also delete the folowing code, but then no longer an confirmation message is send
//build conformation e-mail
$body = "$ty_text $name\n\n";
$body .= "$cnt_shrt_text; $email; \n\n";
$body .= "$y_send_text; \n\n";
$body .= "$message\n\n\n\n\n\n";
$body .= "$auto_res_text";
$Subject = "Auto reply on $Subj2 from Landmarks.nl";
$headers = "From: noreply@yoursite.com\r\n";
$headers .= "Reply-To: noreply@yoursite.com\r\n";
$headers .= "X-Mailer: PHP\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
@mail($email, $Subject, $body, $headers);THIRD; after editing al the above, you have to add some lines to the global.php files in your language dir's
//mail form text
$translated["Contact_form"] = "Contact form";
$translated["mail_text"] = "If you have any questions or comments, you can send them with this form. Please make sure your indications are clear. <br /><br /><br />You must fill in all fields.<br />";
$translated["name_er"] = "fill in your name";
$translated["subj_er"] = "fill in a subject";
$translated["mail_er"] = "fill in a email adress";
$translated["mail_er2"] = "fill in a vallid email adress";
$translated["mess_bl"] = "fill in a message";
$translated["thnk_you"] = "Than you for your email";
$translated["cnt_shrt"] = "We will contact you as soon as possible on the folowing e-mail adres";
$translated["y_send"] = "You send us the folowing message";
$translated["auto_res"] = "WHATCH OUT: This is an automaticly generated email massage, do not answer on this.";
$translated["mail_t_text"] = "Your message";
$translated["capt_code"] = "Confirmation code";
$translated["captcha"] = "Fill in the confirmation code";
$translated["capt_err"] = "fill in the right code";
$translated["name"] = "Name";
$translated["email"] = "Email";
$translated["subject"] = "Subject";
$translated["send"] = "Send your message";These text lines are displayed in the mail form. You have to translate the text yourself (offcourse ;))
---------------------------------------------------------------
An working example of the form is on my site
http://www.landmarks.nl/mail.php?ee_lang=eng
If one sends the next lines from the form;
Name; Jeroen Roelofsen
E-mail adres; mail@mail.com
Subject; Mailform
Your message; The text I submitted
Then body of the message that you'll get in your mail box looks like;
Name: Jeroen Roelofsen
E-mail adres: mail@mail.com
eng:
IP: XXX.XXX.XXX.XXX
Your message:
The text I submitted
Ass you can see, there are 2 extra lines;
eng; means the form is submitted with the english language
the ip is the ip adress of the visitor
You can direcly reply on this mail to you visitor.
---------------------------------------------------------
The visitor itselfs gets the message;
Thank you for your email Jeroen Roelofsen
We will contact you as soon as possible on the folowing e-mail adres; mail@mail.com;
You send us the folowing message;
the text i submitted
WHATCH OUT: This is an automaticly generated email massage, do not answer on this.
And if the visitor reply's to this message, the mail will be sent to the noreply adres you've added
-------------------------------------
Hope you all like the script.
Please reports bugs or changes in this thread