Jump to content


Photo

Send an email when file is uploaded


  • Please log in to reply
14 replies to this topic

#1 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 04 August 2006 - 08:48 PM

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!

#2 PHPSpirit

PHPSpirit
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 04 August 2006 - 09:01 PM


If your uploader use php you can implement a code, read this:

http://php.net/function.mail




#3 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 06 August 2006 - 05:49 AM

Ok so I tried this 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);
?> 

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?

#4 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 06 August 2006 - 05:54 AM

Well, if you used my code, like I offered.. !! lmao!!
Link shortener with advanced, detailed statistics:

http://tyny.us/

#5 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 06 August 2006 - 05:59 AM

Not funny and not helpfull at this point. I am trying to LEARN here :P


#6 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 06 August 2006 - 06:06 AM

hav the mail stuff been specified in php.ini
I am a PHP Guru, ask me questions if you want to

#7 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 06 August 2006 - 06:11 AM

O.o what? Me=noob

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 August 2006 - 06:32 AM

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.







Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 06 August 2006 - 06:39 AM

I got that directly off of THIS SITE so why would it be wrong? The only thing I changed is the email address...

#10 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 August 2006 - 06:47 AM

every 70 words brake so if there was 200 words every 70 words get a brake.
$message = wordwrap($message, 70, "<br>" , 1);

only show 70 words
$message = substr($message, 0, 70);

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#11 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 06 August 2006 - 10:43 AM

@redarrow,

perhaps you should re-read the manual. Nothing wrong with Elusid's wordwrap() call.

<?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>';
?>

gives -->
[pre]This is the text to
word wrapped so the
lines are a maximum
length of twenty
characters
[/pre]
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#12 ignace

ignace
  • Moderators
  • Now mod flavored
  • 6,431 posts
  • LocationBelgium

Posted 06 August 2006 - 10:48 AM

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


if (mail(..)) {
 // mail success
} else {
 // mail problem...
}


#13 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 06 August 2006 - 10:53 AM

O.o what? Me=noob


Search for "[mail function]" in your php.ini file. Mail settings are in that section.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#14 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 06 August 2006 - 12:54 PM

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
I am a PHP Guru, ask me questions if you want to

#15 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 07 August 2006 - 07:30 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users