This topic is locked
[SOLVED]

 Again, email from register.php

4/30/2008 07:35:59
PHPRunner General questions
R
rainerwolf author

Hello Jane,
I have tried your hint about email from: "to add sending emails check off Send email ... options on the User login settings dialog on the Security tab."
But whatever i do, the result are always the defaults from php.ini.
In the topic: http://www.asprunner.com/forums/index.php?showtopic=6481, you wrote following:
// To send HTML mail, the Content-type header must be set

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers

$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";

$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
mail($to, $subject, $message, $headers);
I don't know, at which place i must insert the code in register.php or ?
Rainer

J
Jane 4/30/2008

Rainer,
yes, add this code to the generated register.php file.

Also you can add this code to the source C:/Program Files/PHPRunner4.2/source/register.php file. In this case you don't need to edit register.php file after each re-build.

R
rainerwolf author 4/30/2008

Rainer,

yes, add this code to the generated register.php file.

Also you can add this code to the source C:/Program Files/PHPRunner4.2/source/register.php file. In this case you don't need to edit register.php file after each re-build.


Hello Jane,

thank you very much for your reply. But i want to know, at which PLACE i must insert the code above.
Do you mean after: send email to user, or at the begining, or ending of register.php?

J
Jane 4/30/2008

Rainer,
add this code just before mail() calling:

//add your code here

mail(...,...,$message);

R
rainerwolf author 4/30/2008

Rainer,

add this code just before mail() calling:


OK, i did it.
I got this result:
Von: w0057a22@dd11212.server.com [mailto:w0057a22@dd11212.server.com]

Gesendet: Mittwoch, 30. April 2008 17:55

An: rainer.wolf@example.de

Betreff: Sie haben sich registriert bei:

http://www.findme.de/bewerber/register.php Klicken Sie auf diesen Link um Ihre Registrierung abzuschliessen:

http://www.findme.de/bewerber/register.php...mp;u=cmFpbmVyLn

dvbfgtAc3doLWhlaWRlci5mbb
MIME-Version: 1.0

Content-type: text/html; charset=iso-8859-1

From: Birthday Reminder <birthday@example.com>
As you see, the from: is correct, but look at: Von: w0057a22@dd11212.server.com [mailto:w0057a22@dd11212.server.com]
What can i do for this, because the sender must be birthday@example.com and not w0057a22@dd11212.server.com
Hope, you understand me and you have a solution.

S
spintz 4/30/2008

look for sendmail_from config option in you php.ini

R
rainerwolf author 5/1/2008

look for sendmail_from config option in you php.ini


Hi,

thank you very much for the hint. Because i work on an external server, i have no chance, to change the php.ini.
But now i have a solution for the register.php in my project:
Following the original code:
// send letter to admin

$message="Benutzer registriert bei"." ".$url."\r\n";

$label = "Passwort";

$message.=$label.": ".$values["Passwort"]."\r\n";

$label = "Email";

$message.=$label.": ".$values["Email"]."\r\n";

$label = "Name";

$message.=$label.": ".$values["Name"]."\r\n";

$label = "Vorname";

$message.=$label.": ".$values["Vorname"]."\r\n";

$label = "Geburtsdatum";

$message.=$label.": ".$values["Geburtsdatum"]."\r\n";

$label = "Strasse und Hausnummer";

$message.=$label.": ".$values["Strasse_Hausnummer"]."\r\n";

$label = "PLZ und Ort";

$message.=$label.": ".$values["PLZ_und_ort"]."\r\n";

And here the additional code:
// To send HTML mail, the Content-type header must be set

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$subject="Registrierung at domain";
$headers .= 'From: sendername <info@example.de>' . "\r\n";
mail($strEmail, $subject, $message, $headers );

And the code to comment out:
//mail($strEmail, $message, $headers);
Kind regards

R
rainerwolf author 5/1/2008



OK, i did it.
I got this result:
Von: w0057a22@dd11212.server.com [mailto:w0057a22@dd11212.server.com]

Gesendet: Mittwoch, 30. April 2008 17:55

An: rainer.wolf@example.de

Betreff: Sie haben sich registriert bei:

http://www.findme.de/bewerber/register.php Klicken Sie auf diesen Link um Ihre Registrierung abzuschliessen:

http://www.findme.de/bewerber/register.php...mp;u=cmFpbmVyLn

dvbfgtAc3doLWhlaWRlci5mbb
MIME-Version: 1.0

Content-type: text/html; charset=iso-8859-1

From: Birthday Reminder <birthday@example.com>
As you see, the from: is correct, but look at: Von: w0057a22@dd11212.server.com [mailto:w0057a22@dd11212.server.com]
What can i do for this, because the sender must be birthday@example.com and not w0057a22@dd11212.server.com
Hope, you understand me and you have a solution.


Hi Jane,
thanks for your hint:
i have a solution for the register.php in my project:
Following the original code:
// send letter to admin

$message="Benutzer registriert bei"." ".$url."\r\n";

$label = "Passwort";

$message.=$label.": ".$values["Passwort"]."\r\n";

$label = "Email";

$message.=$label.": ".$values["Email"]."\r\n";

$label = "Name";

$message.=$label.": ".$values["Name"]."\r\n";

$label = "Vorname";

$message.=$label.": ".$values["Vorname"]."\r\n";

$label = "Geburtsdatum";

$message.=$label.": ".$values["Geburtsdatum"]."\r\n";

$label = "Strasse und Hausnummer";

$message.=$label.": ".$values["Strasse_Hausnummer"]."\r\n";

$label = "PLZ und Ort";

$message.=$label.": ".$values["PLZ_und_ort"]."\r\n";
And here the additional code:
// To send HTML mail, the Content-type header must be set

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$subject="Registrierung at domain";
$headers .= 'From: sendername <info@example.de>' . "\r\n";
mail($strEmail, $subject, $message, $headers );
And the code to comment out:
//mail($strEmail, $message, $headers);
Kind regards

Rainer

S
steveh 5/2/2008

Remember that for certain paramaters you can use ini_set to change them if this helps in the future.