Roman Posted March 1, 2010 Report Posted March 1, 2010 I would like to send a message from formular on site: http://www.vin (antispam measure) yly.ic.cz/form_cz_flashplayer_imagerotator.htm to vinyl2006@seznam.cz (always fix email address)and than to variable address (according the email address in form. field) at the same time.I tried many combinations but nothing helped to solve this problem. Thank to anybody in forward for any help! ------------------------ This is an example of UNWORKING script processor.php (mail functions are behind each other): <?php$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));$headers = "Content-type: text/plain; charset=utf-8\n";mail("vinyl2006@seznam.cz","formular - vinyly.ic.cz"); mail($_POST['field'],"formular - vinyly.ic.cz");"Form data:username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok? (Pi?te ??slo): " . $_POST['field_6'] . " powered by PFG.", $headers);include("confirm.html");?> or mail(trim($_POST['email']).", vinyl2006@seznam.cz", "formular - vinyly.ic.cz");"Form data: -------------------------------------------------- This is an example of WORKING script (but works only with one email address, either variable or fix): <?php$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));$headers = "Content-type: text/plain; charset=utf-8\n";mail("vinyl2006@seznam.cz"," formular - vinyly.ic.cz","Form data:username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok? (Pi?te ??slo): " . $_POST['field_6'] . "powered by PFG.", $headers);include("confirm.html");?> or mail($_POST['field_2'],"formular - vinyly.ic.cz");"Form data: Quote
dms Posted March 1, 2010 Report Posted March 1, 2010 mail($_POST['field'],"formular - vinyly.ic.cz");"Form data: I'm just learning myself, but shouldn't... 'field' in the $_POST['field'] be... 'field_2' I'm sure others can give you better advice, good luck. Quote
Roman Posted March 1, 2010 Author Report Posted March 1, 2010 Hi dms, thank you. But this code is not working. I tried for example this scripts below: (All of them are not working!) ------------------------------------- proc.55 mail($_POST['field_2']).","P?edm?t", "Text zpr?vy","Form data: Parse error: syntax error, unexpected T_STRING in /home/free/ic.cz/v/vinyly/root/www/formular_control_corection_total_2/processor.php on line 4 ------------------------------------- proc.56 mail($_POST['field_2']).","P?edm?t", "Text zpr?vy";"Form data: Parse error: syntax error, unexpected T_STRING in /home/free/ic.cz/v/vinyly/root/www/formular_control_corection_total_2/processor.php on line 4 ----------------------------------------------------- proc.62 - odesl?no (zobraz? se potvrzuj?c? str?nka), ale nedoru?eno mail(trim($_POST['field_2']),"vinyl2006@seznam.cz","P?edm?t","Text zpr?vy","Form data: ----------------------------------------------------- proc.63 mail(trim($_POST['field_2'],"vinyl2006@seznam.cz","P?edm?t","Text zpr?vy","Form data: Parse error: syntax error, unexpected ';' in /home/free/ic.cz/v/vinyly/root/www/formular_control_corection_total_2/processor.php on line 7 --------------------------------------- proc.64 mail($_POST['field_2']),"vinyl2006@seznam.cz","P?edm?t","Text zpr?vy","Form data: Parse error: syntax error, unexpected ',' in /home/free/ic.cz/v/vinyly/root/www/formular_control_corection_total_2/processor.php on line 4 ---------------------------------------- proc.65 mail(trim($_POST['field_2']) .","vinyl2006@seznam.cz","P?edm?t","Text zpr?vy";"Form data: Parse error: syntax error, unexpected T_STRING in /home/free/ic.cz/v/vinyly/root/www/formular_control_corection_total_2/processor.php on line 4 Quote
Roman Posted March 1, 2010 Author Report Posted March 1, 2010 mail($_POST['field']' date='"formular - vinyly.ic.cz");"Form data: [/quote'] I'm just learning myself, but shouldn't... 'field' in the $_POST['field'] be... 'field_2' I'm sure others can give you better advice, good luck. Thank you. But thats right ...look at the last script, that I mentioned. Problem is to resend the message to one fix and one variable address at the same time. I tried many combinations. All are on: http://www.vinyly.ic.cz/scripttests.txt The struggle continue. Quote
dms Posted March 2, 2010 Report Posted March 2, 2010 You might try using the bcc to send the second email to the fixed location and also use some variables to store some info. Something like this. $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; // not sure you need this header. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $message = "Form data: username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok?; mail($to, $subject, $message, $headers); Keep in mind I'm new at this. good luck. You may also check out... http://us2.php.net/manual/en/function.mail.php Quote
Roman Posted March 4, 2010 Author Report Posted March 4, 2010 You might try using the bcc to send the second email to the fixed location and also use some variables to store some info. Something like this. $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; // not sure you need this header. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $message = "Form data: username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok?; mail($to, $subject, $message, $headers); Keep in mind I'm new at this. good luck. You may also check out... http://us2.php.net/manual/en/function.mail.php Thank you very much for your response. I?m new just like you. Started with PHP just two weeks ago. Your code send the email to fix and variable address at the same time but the message field (in email) is empty. proc.72 - yes (arrived on fix and variable email address, but there is nothing in email message-field) <?php$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));$headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; $headers = 'Bcc: vinyl2006@seznam.cz'; // permanent email address.$to = $_POST['field_2']; // captured from the form.$subject = 'formular - vinyly.ic.cz';$message = "Form data:username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok?; (Pi?te ??slo): " . $_POST['field_6'] .mail($to, $subject, $message, $headers);include("confirm.html");?> $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; // not sure you need this header. Yes I need this type of coding because of Czech language. It has special signs like: ??????????? . ------------------ I ?ve done some tests but nothing fixed this mistake. You can check : http://www.vinyly.ic.cz/processor_coding_test_script changes_short_version_(processor.php ) .txt Thank you anyway! Quote
dms Posted March 5, 2010 Report Posted March 5, 2010 $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; // not sure you need this header. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $message = "Form data: username: " . $_POST['field_1'] . " Email: " . ((($to))) . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok?; mail($to, $subject, $message, $headers); Not quite sure what your asking, but you might try changing to the (((code))) above. Be sure and remove the brackets ((())). If your not receiving anything at all in the message area of the email, try changing $message to... $message='testing'; ...and see if (testing) transfers to your email. Mark Quote
Roman Posted March 5, 2010 Author Report Posted March 5, 2010 (edited) Hi Mark, thank you for your answer. I fixed the problem yesterday late at night. Right code is: proc.120-yes (both emails but wrong text coding-?? ?) <?php$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));$headers = 'Content-type: text/plain; charset=utf-8\n'; $headers = 'Bcc: vinyl2006@seznam.cz'; $to = $_POST['field_2']; $subject = 'formular - vinyly.ic.cz';$message = "Form data:username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] ;mail($to, $subject, $message, $headers);include("confirm.html");?> behind $_POST['field_5'] ; has to be ; (semicolon) and no . (full point) now I?m triyng to solve out the set up of charset (text) Edited March 5, 2010 by Roman Quote
Roman Posted March 5, 2010 Author Report Posted March 5, 2010 (edited) $headers = "Content-type: text/plain; charset=utf-8 ". " " ; // not sure you need this header. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $message = "Form data: username: " . $_POST['field_1'] . " Email: " . ((($to))) . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] . " Jak? je rok?; mail($to, $subject, $message, $headers); Not quite sure what your asking, but you might try changing to the (((code))) above. Be sure and remove the brackets ((())). If your not receiving anything at all in the message area of the email, try changing $message to... $message='testing'; ...and see if (testing) transfers to your email. Mark Please write exactly the whole code. The code above send email only to fix email address and with wrong text coding (no ???). (I just want to prove all possibilities...) Thank you. Edited March 5, 2010 by Roman Quote
dms Posted March 5, 2010 Report Posted March 5, 2010 I believe you need the return and newline character sequence after each header except for maybe the last one. I also think a From Header is required in the mail function, which could be different than the Bcc address. If you have a line over 70 characters long you need to clean it up a bit like I did below. If the message is just a general message and does not need much layout, you could use the wordwrap () function. Keep in mind, I'm learning myself, so take this for what it worth. $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; $headers = 'From: vinyl2006@seznam.cz' . "\r\n" ; // could be a different address from the one I'm using here. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $username = $_POST['field_1']; $field_3 = $_POST['field_3']; // change this variable name to suit you and use it in the message $field_4 = $_POST['field_4']; // change this variable name to suit you and use it in the message $field_5 = $_POST['field_5']; // change this variable name to suit you and use it in the message $message = "Form data:\n" . "username: $username\n" . "Email: $to\n" . "Telefon: $field_3\n" . "Zem?: $field_4\n" . "Zpr?va: $field_5\n" . 'Jak? je rok?'; mail($to, $subject, $message, $headers); Quote
Roman Posted March 8, 2010 Author Report Posted March 8, 2010 (edited) I believe you need the return and newline character sequence after each header except for maybe the last one. I also think a From Header is required in the mail function, which could be different than the Bcc address. If you have a line over 70 characters long you need to clean it up a bit like I did below. If the message is just a general message and does not need much layout, you could use the wordwrap () function. Keep in mind, I'm learning myself, so take this for what it worth. $headers = "Content-type: text/plain; charset=utf-8 ". " " ; $headers = 'From: vinyl2006@seznam.cz' . " " ; // could be a different address from the one I'm using here. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $username = $_POST['field_1']; $field_3 = $_POST['field_3']; // change this variable name to suit you and use it in the message $field_4 = $_POST['field_4']; // change this variable name to suit you and use it in the message $field_5 = $_POST['field_5']; // change this variable name to suit you and use it in the message $message = "Form data: " . "username: $username " . "Email: $to " . "Telefon: $field_3 " . "Zem?: $field_4 " . "Zpr?va: $field_5 " . 'Jak? je rok?'; mail($to, $subject, $message, $headers); Hi Mark, Thank for your respond. Your code above, send message to both email addresses(fix and variable) but the text coding is still wrong. I tried to fix the text coding but still it does not works. Btw. this code (send March 5, 2010) is doing the same work like your above, just the text coding (??????? ????) is too not working. proc.120-yes (both emails but wrong text coding-?? ?) <?php$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));$headers = 'Content-type: text/plain; charset=utf-8\n'; $headers = 'Bcc: vinyl2006@seznam.cz'; $to = $_POST['field_2']; $subject = 'formular - vinyly.ic.cz';$message = "Form data:username: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Telefon: " . $_POST['field_3'] . " Zem?: " . $_POST['field_4'] . " Zpr?va: " . $_POST['field_5'] ;mail($to, $subject, $message, $headers);include("confirm.html");?> Edited March 8, 2010 by Roman Quote
dms Posted March 8, 2010 Report Posted March 8, 2010 You may want to use the latest code I used to where you transfer form data into a variable. The next step for you would be to validate the form data using the variables, so it's a good habit for you to get into and It's just cleaner. $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; $headers = 'From: vinyl2006@seznam.cz' . "\r\n" ; // could be a different address from the one I'm using here. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $username = $_POST['field_1']; $field_3 = $_POST['field_3']; // change this variable name to suit you and use it in the message $field_4 = $_POST['field_4']; // change this variable name to suit you and use it in the message $field_5 = $_POST['field_5']; // change this variable name to suit you and use it in the message $message = "Form data:\n" . "username: $username\n" . "Email: $to\n" . "Telefon: $field_3\n" . "Zem?: $field_4\n" . "Zpr?va: $field_5\n" . 'Jak? je rok?'; mail($to, $subject, $message, $headers); I'm not sure what you mean by the text coding? Are you referring to the ...... $headers = "Content-type: text/plain; charset=utf-8". " " ; . It could be that you are not using the return and new line character sequence after the first two headers. The charset is something that I'm not very familiar with, so if setting it to fit you situation may require you to start a new post dealing with just that header. This is what you have now. $headers = "Content-type: text/plain; charset=utf-8 ". " " ; $headers = 'From: vinyl2006@seznam.cz' . " " ; $headers = 'Bcc: vinyl2006@seznam.cz'; And it should be this below. I don't understand why you have are concatenating an empty string to the end of the first two headers? I'm pretty sure you need the return and new line character sequence like on the first two header below.... $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; // return and new line character sequence needed ("\r\n") $headers = 'From: vinyl2006@seznam.cz' . "\r\n" ; // return and new line character sequence needed ("\r\n") $headers = 'Bcc: vinyl2006@seznam.cz'; Good luck Quote
Roman Posted March 8, 2010 Author Report Posted March 8, 2010 (edited) proof Edited March 8, 2010 by Roman Quote
Roman Posted March 8, 2010 Author Report Posted March 8, 2010 You may want to use the latest code I used to where you transfer form data into a variable. The next step for you would be to validate the form data using the variables, so it's a good habit for you to get into and It's just cleaner. $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; $headers = 'From: vinyl2006@seznam.cz' . "\r\n" ; // could be a different address from the one I'm using here. $headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address. $to = $_POST['field_2']; // captured from the form. $subject = 'formular - vinyly.ic.cz'; $username = $_POST['field_1']; $field_3 = $_POST['field_3']; // change this variable name to suit you and use it in the message $field_4 = $_POST['field_4']; // change this variable name to suit you and use it in the message $field_5 = $_POST['field_5']; // change this variable name to suit you and use it in the message $message = "Form data:\n" . "username: $username\n" . "Email: $to\n" . "Telefon: $field_3\n" . "Zem?: $field_4\n" . "Zpr?va: $field_5\n" . 'Jak? je rok?'; mail($to, $subject, $message, $headers); I'm not sure what you mean by the text coding? Are you referring to the ...... $headers = "Content-type: text/plain; charset=utf-8". " " ; . It could be that you are not using the return and new line character sequence after the first two headers. The charset is something that I'm not very familiar with, so if setting it to fit you situation may require you to start a new post dealing with just that header. This is what you have now. $headers = "Content-type: text/plain; charset=utf-8 ". " " ; $headers = 'From: vinyl2006@seznam.cz' . " " ; $headers = 'Bcc: vinyl2006@seznam.cz'; And it should be this below. I don't understand why you have are concatenating an empty string to the end of the first two headers? I'm pretty sure you need the return and new line character sequence like on the first two header below.... $headers = "Content-type: text/plain; charset=utf-8\n". "\r\n" ; // return and new line character sequence needed ("\r\n") $headers = 'From: vinyl2006@seznam.cz' . "\r\n" ; // return and new line character sequence needed ("\r\n") $headers = 'Bcc: vinyl2006@seznam.cz'; Good luck Thanks but the result of processor.php code is same with "\r\n" ; or without it. You can try it. <?php$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));$headers = "Content-type: text/plain; charset=utf-8"; $headers = 'From: vinyl2006@seznam.cz' ; // could be a different address from the one I'm using here.$headers = 'Bcc: vinyl2006@seznam.cz'; // this would be your permanent email address.$to = $_POST['field_2']; // captured from the form.$subject = 'formular - vinyly.ic.cz';$username = $_POST['field_1'];$field_3 = $_POST['field_3']; // change this variable name to suit you and use it in the message $field_4 = $_POST['field_4']; // change this variable name to suit you and use it in the message $field_5 = $_POST['field_5']; // change this variable name to suit you and use it in the message $message = "Form data:\n" ."username: $username\n" ."Email: $to\n" ."Telefon: $field_3\n" ."Zem?: $field_4\n" ."Zpr?va: $field_5\n" ;'Jak? je rok?';mail($to, $subject, $message, $headers);include("confirm.html");?> Quote
dms Posted March 8, 2010 Report Posted March 8, 2010 Okay, I believe you. But what do you mean by text coding? Quote
Roman Posted March 8, 2010 Author Report Posted March 8, 2010 $headers = "Content-type: text/plain; charset=utf-8"; the script above determinate text coding. (it can be for example: utf-8, windows 1250 ...etc.) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.