Elusid Posted August 4, 2006 Share Posted August 4, 2006 Ok how can I get my site to send me an email when a new file is uploaded with one of my uploaders? I have several uploaders on my site and I want it so when the user uploads the files it will send me an email saying that they have uploaded it and give me the URL to the folder where it was uploaded. It makes is a lot easer then having to go through the site looking all the time. Thanks! Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/ Share on other sites More sharing options...
PHPSpirit Posted August 4, 2006 Share Posted August 4, 2006 If your uploader use php you can implement a code, read this:http://php.net/function.mail Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-69441 Share on other sites More sharing options...
Elusid Posted August 6, 2006 Author Share Posted August 6, 2006 Ok so I tried this code[code]<?php// The message$message = "Line 1\nLine 2\nLine 3";// In case any of our lines are larger than 70 characters, we should use wordwrap()$message = wordwrap($message, 70);// Sendmail('[email protected]', 'My Subject', $message);?> [/code]and uploaded it to my server. When I go to the url of the file it's a while screen, no error, and I don't get an email. How do I get this to work right? Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70052 Share on other sites More sharing options...
techiefreak05 Posted August 6, 2006 Share Posted August 6, 2006 Well, if you used my code, like I offered.. !! lmao!! Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70055 Share on other sites More sharing options...
Elusid Posted August 6, 2006 Author Share Posted August 6, 2006 Not funny and not helpfull at this point. I am trying to LEARN here :P Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70059 Share on other sites More sharing options...
Chetan Posted August 6, 2006 Share Posted August 6, 2006 hav the mail stuff been specified in php.ini Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70061 Share on other sites More sharing options...
Elusid Posted August 6, 2006 Author Share Posted August 6, 2006 O.o what? Me=noob Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70063 Share on other sites More sharing options...
redarrow Posted August 6, 2006 Share Posted August 6, 2006 can you look up wordwrap agin ok.your format is wrong ok word wrap is to add a brake or new line at a set number of chsrecters not shorten charecters.substr is to get the number of charecters to be shown ok. Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70069 Share on other sites More sharing options...
Elusid Posted August 6, 2006 Author Share Posted August 6, 2006 I got that directly off of THIS SITE so why would it be wrong? The only thing I changed is the email address... Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70072 Share on other sites More sharing options...
redarrow Posted August 6, 2006 Share Posted August 6, 2006 every 70 words brake so if there was 200 words every 70 words get a brake.[code]$message = wordwrap($message, 70, "<br>" , 1);[/code]only show 70 words[code]$message = substr($message, 0, 70);[/code] Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70074 Share on other sites More sharing options...
Barand Posted August 6, 2006 Share Posted August 6, 2006 @redarrow,perhaps you should re-read the manual. Nothing wrong with Elusid's wordwrap() call.[code]<?php$text = "This is the text to word wrapped so the lines are a maximum length of twenty characters";echo '<pre>', wordwrap($text, 20), '</pre>';?>[/code]gives -->[pre]This is the text toword wrapped so thelines are a maximumlength of twentycharacters[/pre] Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70129 Share on other sites More sharing options...
ignace Posted August 6, 2006 Share Posted August 6, 2006 mail returns a boolean value, use if/else to check its status. Also set your error reporting to error_reporting(E_ALL); <-- this has saved me already a lot of time/problems[code]if (mail(..)) { // mail success} else { // mail problem...}[/code] Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70135 Share on other sites More sharing options...
Barand Posted August 6, 2006 Share Posted August 6, 2006 [quote author=Elusid link=topic=103026.msg410521#msg410521 date=1154844711]O.o what? Me=noob[/quote]Search for "[mail function]" in your php.ini file. Mail settings are in that section. Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70137 Share on other sites More sharing options...
Chetan Posted August 6, 2006 Share Posted August 6, 2006 Thats wat i wanted to say, if u r on Windows u need to specify youur mail server and port else specify the path of sendmail Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70181 Share on other sites More sharing options...
Elusid Posted August 7, 2006 Author Share Posted August 7, 2006 Well I will look on the server I am useing. It's actually a hositng service in Europe and they use Linux would that cause any probs? Link to comment https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/#findComment-70804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.