Jump to content

[SOLVED] Once file is uploaded to server, Can i get an "Alert Email"


iceman023

Recommended Posts

I was just wondering, is there anyway i can get an email once someone has uploaded a file to my server, just to let me know that there's activity. Maybe something like a hidden submit button to send an email or something.

 

Any ideas would be great... Thanks

Link to comment
Share on other sites

pretty simple.. if you use a POST method form.. when a file is done uploading it will trigger a

 

$_POST['submit']  then after it triggers you can use a IF Statment where you know.. you put the filename into mysql or whatever..

 

if(isset($_POST['submit'])) {

mail('yourEmail@yourDomain.com', 'File Uploaded',  "A file has been uploaded!");

}

Link to comment
Share on other sites

Ok thanks very much i got it to work. Now after doing some research i want to make the email look better.. I did an include command to call a new page called alertemail.php. This time im getting an error

 

Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in *****alertemail.php on line 23

 

<?php
{
$to = 'myemailaddress@abc.com';
$subject = 'Activity';
$message = '
<html>
<head><title></title>
</head>
<body>
<center>
  <p>A file has been uploaded to your site!</p>
  <p><a href="admin.php">Click here to go to admin</a></p>
  <p><img src="photo1.jpg" width="144" height="36"></p>
</center>

</body></html>
';
$message = wordwrap($message, 70);

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

mail($to, $subject, $message, $headers);
}
?>

 

What do you think the problem is???

 

 

Link to comment
Share on other sites

Ok thanks very much i got it to work. Now after doing some research i want to make the email look better.. I did an include command to call a new page called alertemail.php. This time im getting an error

 

Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in *****alertemail.php on line 23

 

<?php
{
$to = 'myemailaddress@abc.com';
$subject = 'Activity';
$message = '
<html>
<head><title></title>
</head>
<body>
<center>
  <p>A file has been uploaded to your site!</p>
  <p><a href="admin.php">Click here to go to admin</a></p>
  <p><img src="photo1.jpg" width="144" height="36"></p>
</center>

</body></html>
';
$message = wordwrap($message, 70);

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

mail($to, $subject, $message, $headers);
}
?>

 

What do you think the problem is???

 

try replacing the message with this

 

$message = '\r\n
<html>\r\n
<head><title></title>\r\n
</head>\r\n
<body>\r\n
<center>\r\n
  <p>A file has been uploaded to your site!</p>\r\n
  <p><a href="admin.php">Click here to go to admin</a></p>\r\n
  <p><img src="photo1.jpg" width="144" height="36"></p>\r\n
</center>\r\n
\r\n
</body></html>\r\n
';

 

no guarantees that will do anything.

Link to comment
Share on other sites

Yes thank you, i have fix that error now..

 

Now everything looks good but i want a link within the email.. The problem is, is that it just appears as text "NO LINK"

 

I echoed out $messages and opened the page in a browser and the link works there. Just not in an email.

 

Why do you think this is..

Link to comment
Share on other sites

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.