CodeIgniter Forums
Automatic mail sending - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Automatic mail sending (/thread-37507.html)

Pages: 1 2


Automatic mail sending - El Forum - 01-14-2011

[eluser]defectivereject[/eluser]
If you're on a Mac, i found this link the much easier of any to follow.
Fairly straight forward infact.
http://drupal.org/node/434416


Automatic mail sending - El Forum - 01-14-2011

[eluser]Atharva[/eluser]
Forgot to mention, you can connect to db in cron file using settings from system/application/database.php as follows
Code:
mysql_connect($db[$active_group]['hostname'],$db[$active_group]['username'],$db[$active_group]['password']) or die("Error in correction");

mysql_select_db($db[$active_group]['database']) or die("Error in selecting database");



Automatic mail sending - El Forum - 01-14-2011

[eluser]Roy MJ[/eluser]
Thankyou.. I think it'l work.. Ive been thinking i cant use pure php inside codeigniter. Now its making sense. Thankyou..


Automatic mail sending - El Forum - 01-14-2011

[eluser]Roy MJ[/eluser]
Ok here is what i am getting from mailer demon

/bin/sh: php/home/aromaren/public_html/cron.php: No such file or directory

My cron.php looks looks like this:

Code:
<?php
define('BASEPATH',1);
require('../system/application/config/database.php');
require('../system/application/config/config.php');
/*$con = mysql_connect($db['default']['hostname'],$db['default']['username'],$db['default']['password']);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($db['default']['database'], $con);

$functiontype = $_GET['functiontype'];
$id     =     $_GET['id'];
switch($functiontype){
    case 'cars_id' : list_cars($id);
                        break;

}
mysql_close();*/
                $recipient = "[email protected]"; // Who the email is too
                $subject = "aroma";
                $message ="helooooooo";
                    $frm_name = "bigiil";
                    $email "[email protected]";
                    $mailheader = "From: $frm_name\r\n";
                    $mailheader .= "Reply-To: $email\r\n";
                    $mailheader .= "MIME-Version: 1.0\r\n";
                    mail($recipient, $subject, $message, $mailheader)
?>


The command i gave in the cpanel is : php/home/aromaren/public_html/cron.php


The error says there is no file or directory ..Can you see what i am doing wrong?


Automatic mail sending - El Forum - 01-14-2011

[eluser]Atharva[/eluser]
Can you execute this file through browser ans see what happens?


Automatic mail sending - El Forum - 01-14-2011

[eluser]Roy MJ[/eluser]
When i access it through browser i am getting this :


Warning: require(../system/application/config/database.php) [function.require]: failed to open stream: No such file or directory in /home/aromaren/public_html/cron.php on line 3

Warning: require(../system/application/config/database.php) [function.require]: failed to open stream: No such file or directory in /home/aromaren/public_html/cron.php on line 3

Fatal error: require() [function.require]: Failed opening required '../system/application/config/database.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/aromaren/public_html/cron.php on line 3


Automatic mail sending - El Forum - 01-14-2011

[eluser]Atharva[/eluser]
If cron.php is on root folder, then remove '..'
Code:
require('system/application/config/database.php');
require('system/application/config/config.php');



Automatic mail sending - El Forum - 01-14-2011

[eluser]Roy MJ[/eluser]
Heyy.. Solved..!!!!!.. Actually i was using require function ... When i changed to include as u had told earlier it worked well.. Thanks a lot..


Automatic mail sending - El Forum - 01-14-2011

[eluser]Roy MJ[/eluser]
Yes i have changed that too.. Thanks a lot..