Mailafzender
Ik heb een php mailscriptje, waarin je het mailadres van de verzender en de ontvanger meot weergeven, hij schrijft al deze gegevens in de mail, maar als ik het mailtje binnenkrijg staat er als mailadres van de afzender [email protected] ofzo.
Heeft iemand eens script dat ik mijn variabele (van mail verzender) als mailadres kan laten zien, ofdat als je mail terugstuurt naar die mail word verstuurd, ipv dat rare mailadres:S
Heeft iemand eens script dat ik mijn variabele (van mail verzender) als mailadres kan laten zien, ofdat als je mail terugstuurt naar die mail word verstuurd, ipv dat rare mailadres:S
Wat is er mis met de handleiding? Daar staat het letterlijk...
http://www.php.net/manual/en/function.mail.php
http://www.php.net/manual/en/function.mail.php
ik snap je dus niet, ik zie nergens iets staan wat mijn vraag beantwoord, want ik wil alleen dia [email protected] vervangen door het emailadres van de ontvanger (dat deze heeft ingevuld)
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
Lezen :).
bedankt, maar ik ben er nog steeds niet uit hoe ik dit toepas in mijn script
In mijn html staat een form, en de gegevens hiervan worden in mn php script gebruikt voor te mailen.
dit is mijn php bestand, kan iemand me even helpen hoe ik dit toepas in mn script?:
<html>
<head><title>PHP Mail Sender</title></head>
<body>
</body>
</html>
In mijn html staat een form, en de gegevens hiervan worden in mn php script gebruikt voor te mailen.
dit is mijn php bestand, kan iemand me even helpen hoe ik dit toepas in mn script?:
<html>
<head><title>PHP Mail Sender</title></head>
<body>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$emailverz = $HTTP_POST_VARS['emailverz'];
$emailontv = $HTTP_POST_VARS['emailontv'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
/* PHP form validation: the script checks that the Email Verzender field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailverz)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* PHP form validation: the script checks that the Email Ontvanger field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailontv)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
$emailverz = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($emailontv,$emailverz,$subject,$message,$headers)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$emailverz = $HTTP_POST_VARS['emailverz'];
$emailontv = $HTTP_POST_VARS['emailontv'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
/* PHP form validation: the script checks that the Email Verzender field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailverz)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* PHP form validation: the script checks that the Email Ontvanger field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailontv)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
$emailverz = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($emailontv,$emailverz,$subject,$message,$headers)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>
</body>
</html>
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: '.$emailverz."\r\n" .
'Reply-To: '.$emailverz . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: '.$emailverz."\r\n" .
'Reply-To: '.$emailverz . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
ff aangepast zodat het nu nog duidelijker moet zijn.
Gewijzigd op 01/01/1970 01:00:00 door Robert Deiman
omfg, hij doet het nog steeds niet, dit is mijn code van mn php bestand:
en dit is de code van mn html bestand:
<html>
<head><title>Mail sender</title>
</head>
<body>
<form action="test.php" method="POST">
<p><b>Email Ontvanger</b> <br>
<input type="text" name="emailontv" size=40>
</p>
<p><b>Email Verzender </b><br>
<input type="text" name="emailverz" size=40>
</p>
<p><b>Subject</b><br>
<input type="text" name="subj" size=40>
<p><b>Message</b><br>
<textarea cols=40 rows=10 name="msg"></textarea>
<p><input type="submit" value=" Send ">
</form>
</body>
</html>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$emailverz = $HTTP_POST_VARS['emailverz'];
$emailontv = $HTTP_POST_VARS['emailontv'];
$subj = $HTTP_POST_VARS['subject'];
$msg = $HTTP_POST_VARS['msg'];
$to = '$emailontv';
$subject = '$subj';
$message = '$msg';
$headers = 'From: '.$emailverz."\r\n" .
'Reply-To: '.$emailverz . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$emailverz = $HTTP_POST_VARS['emailverz'];
$emailontv = $HTTP_POST_VARS['emailontv'];
$subj = $HTTP_POST_VARS['subject'];
$msg = $HTTP_POST_VARS['msg'];
$to = '$emailontv';
$subject = '$subj';
$message = '$msg';
$headers = 'From: '.$emailverz."\r\n" .
'Reply-To: '.$emailverz . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
en dit is de code van mn html bestand:
<html>
<head><title>Mail sender</title>
</head>
<body>
<form action="test.php" method="POST">
<p><b>Email Ontvanger</b> <br>
<input type="text" name="emailontv" size=40>
</p>
<p><b>Email Verzender </b><br>
<input type="text" name="emailverz" size=40>
</p>
<p><b>Subject</b><br>
<input type="text" name="subj" size=40>
<p><b>Message</b><br>
<textarea cols=40 rows=10 name="msg"></textarea>
<p><input type="submit" value=" Send ">
</form>
</body>
</html>
en ja, ik weet t, ik ben niet echt handig met php, ben tijdje geleden begonnen en is er alweer even niet van gekomen
Misschien wat lullig, maar:
From = engels voor 'van'
Reply-to = engels voor 'antwoord aan'
Zo moeilijk kan het toch niet zijn...
Verder raad ik je aan om gewoon eens wat te proberen, in het ergste geval lukt het niet in 1x. Maar van je fouten leer je, dus daar steek je meer van op dat kant-en-klare antwoorden van een ander zo maar te kopieeren in je script.
Ps. $HTTP_POST_VARS['emailverz'] is ernstig verouderd, dat moet zijn $_POST['emailverz']. Dit geldt uiteraard voor de andere variabelen die op deze ouderwetse manier zijn genoteerd.
From = engels voor 'van'
Reply-to = engels voor 'antwoord aan'
Zo moeilijk kan het toch niet zijn...
Verder raad ik je aan om gewoon eens wat te proberen, in het ergste geval lukt het niet in 1x. Maar van je fouten leer je, dus daar steek je meer van op dat kant-en-klare antwoorden van een ander zo maar te kopieeren in je script.
Ps. $HTTP_POST_VARS['emailverz'] is ernstig verouderd, dat moet zijn $_POST['emailverz']. Dit geldt uiteraard voor de andere variabelen die op deze ouderwetse manier zijn genoteerd.
hij moet gezien worden als from emailverz (emailverzender) en reply to emailverzender, dus dat klopt wel
maja, voor de rest snapk r geen hol meer van
maja, voor de rest snapk r geen hol meer van
Quote:
Tja, welke rest? En wat heb je al geprobeerd om deze 'rest' voor jezelf alsnog duidelijk te krijgen? Op deze manier maak je het anderen onmogelijk om jou te helpen, geen mens die weet wat jij verstaat onder 'de rest'.maja, voor de rest snapk r geen hol meer van
ik snap niet wat r four is in mn script
heb gewoo geddaan wat jullie hebben gezegd
heb gewoo geddaan wat jullie hebben gezegd
trouwens de:
is zinloos en als je dit gebruikt moet het iniedergeval zonder de ' zijn dus zo:
voor de rest weet ik het ook niet egt..
wat je altijd ook nog kan proberen is alle variabele echo'en om te kijken of ze wel bestaan
is zinloos en als je dit gebruikt moet het iniedergeval zonder de ' zijn dus zo:
voor de rest weet ik het ook niet egt..
wat je altijd ook nog kan proberen is alle variabele echo'en om te kijken of ze wel bestaan
(zonder de ' is omdat het variabele zijn)
Quote:
En dan nog eens een keer in het Algemeen Beschaafd Nederlands en dan zonder spel- en of tikfouten graag.ik snap niet wat r four is in mn script
(die andere regel kan ik nog net ontcijferen, al had je ook daar wel wat extra moeite voor mogen doen. We zijn hier om elkaar te helpen, niet om topics te ontcijferen.)
sorry, kwas een paar dagen afwezig, en heb nu helaas even niet veel tijd vanwege mijn stage
zodra ik tijd heb proberen we t weer
Grtz
D@niel
zodra ik tijd heb proberen we t weer
Grtz
D@niel
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/* All form fields are automatically passed to the PHP script through the array $_POST. */
$emailverz = $_POST['emailverz'];
$emailontv = $_POST['emailontv'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = 'From: '.$emailontv."\r\n" .
'Reply-To: '.$emailontv."\r\n" .
'X-Mailer: PHP/' . phpversion();
/* PHP form validation: the script checks that the Email Verzender field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailverz)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* PHP form validation: the script checks that the Email Ontvanger field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailontv)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($emailverz,$subject,$message,$headers)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>
/* All form fields are automatically passed to the PHP script through the array $_POST. */
$emailverz = $_POST['emailverz'];
$emailontv = $_POST['emailontv'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = 'From: '.$emailontv."\r\n" .
'Reply-To: '.$emailontv."\r\n" .
'X-Mailer: PHP/' . phpversion();
/* PHP form validation: the script checks that the Email Verzender field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailverz)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* PHP form validation: the script checks that the Email Ontvanger field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailontv)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($emailverz,$subject,$message,$headers)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>
OMG, hij deed t bijna perfect, even 1 paar lettertjes gewijzig in zn POST gedoe en hij werkt
dank u 10000 maal =D
dank u 10000 maal =D
Geen probleem :-)
alleen 1 probleempje, of hotmail is zeeer sloom, of hotmail verwijdert m automatisch, wat nu....
En nu, nu heb je een werkend script, en snap je zelf dus niet waar de fout zat.
Oftewel, je hebt er niks van geleerd, en volgende keer komt deze vraag weer.
Voor je volgende vraag zou ik even zoeken op php mail headers
Oftewel, je hebt er niks van geleerd, en volgende keer komt deze vraag weer.
Voor je volgende vraag zou ik even zoeken op php mail headers




