Jump to content
Killersites Forums

Formular-resend to fix and variable email address at the same time


Recommended Posts

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:

Link to post
Share on other sites

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.

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

Link to post
Share on other sites

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

Link to post
Share on other sites
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!

Link to post
Share on other sites

$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

Link to post
Share on other sites

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 by Roman
Link to post
Share on other sites
$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 by Roman
Link to post
Share on other sites

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);

Link to post
Share on other sites
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 by Roman
Link to post
Share on other sites

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

Link to post
Share on other sites
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");
?>

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...