Jump to content

Archived

This topic is now archived and is closed to further replies.

Elusid

Send an email when file is uploaded

Recommended Posts

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!

Share this post


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

// Send
mail('tech108@gmail.com', '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?

Share this post


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






Share this post


Link to post
Share on other sites
I got that directly off of THIS SITE so why would it be wrong? The only thing I changed is the email address...

Share this post


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

Share this post


Link to post
Share on other sites
@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 to
word wrapped so the
lines are a maximum
length of twenty
characters
[/pre]

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.