Jump to content

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!
Link to comment
https://forums.phpfreaks.com/topic/16588-send-an-email-when-file-is-uploaded/
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('[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?
@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]
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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.