PHP Mail help needed

Discussion in 'PHP' started by computerzworld, Dec 22, 2007.

  1. #1
    Hello friends. I am using php mail function for sending mail. Is it possible using php mail to send the mail to the users at particular time? Let say I have one mail and I want to send that mail at 5 PM today. Is it possible? Please help me. Thanks in advance.
     
    computerzworld, Dec 22, 2007 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    yes you can use php to do this

    Create a table which will store the email id and email to be sent and time

    Just put the info in that table

    Now create a seperate php program which will query that table and compare the time with the time in table and send email

    Put that program in cron say every 15 min

    Thats all

    Regards

    Alex
     
    kmap, Dec 22, 2007 IP
  3. computerzworld

    computerzworld Active Member

    Messages:
    214
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks for the reply.... I searched google for automated mail sending using PHP. But I was unable to find anything. Please explain me by example how can I do this? Thanks again....
     
    computerzworld, Dec 22, 2007 IP
  4. junandya

    junandya Member

    Messages:
    79
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #4
    Yes....you can use cron, IMHO, you should set the cron in the server setting,..in my case,...i use cpanel to set the cron as KMAP said above.
     
    junandya, Dec 22, 2007 IP
  5. computerzworld

    computerzworld Active Member

    Messages:
    214
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #5
    actually I am a newbie in this stuff so what changes that i have to make? Should I have to change configuration of php.ini in the server? And what is cron and how can I use it?
     
    computerzworld, Dec 22, 2007 IP
  6. hosting.network

    hosting.network Banned

    Messages:
    285
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    cmon man u r not understanding at all
     
    hosting.network, Dec 22, 2007 IP
  7. computerzworld

    computerzworld Active Member

    Messages:
    214
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    yeah that's why i need the help... plz help me....
     
    computerzworld, Dec 23, 2007 IP
  8. clogmoney

    clogmoney Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Essentially what they are saying is you create a very simple php script which looks in a database table for an email.
    Now the database table could look something like this.

    EmailAdd | Subject | Body | TimeToSend |

    | my sub | my body | 23/12/07 17:00 |

    Your php script could then check the database for emails to be sent something simple like

    if($row[TimeToSend ] < $timeNow)
    {
    sendEmail(); // Obviously do some checking here to see if the email sent was correct and delete the email from the table if so
    }

    You could then have a cron job run this every 15 mins. Now cron is nothing to do with php. It is a separate program that runs on linux. Some hosting companies allow you web access to cron jobs. Or if you have shell access you can run

    crontab -e

    A good example of using cron can be found

    en.wikipedia.org/wiki/Crontab

    I think I'm correct in all that. If I'm not some one will point it out ;)
     
    clogmoney, Dec 23, 2007 IP
  9. Vio82

    Vio82 Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Is difficult to explain how to do it, because you haven't base knowledges about it.

    Here my advice: try to find free script like PHPmailer or something like this. Is much enouth subscribing scripts.
     
    Vio82, Dec 23, 2007 IP