{"id":1523,"date":"2017-05-29T12:16:03","date_gmt":"2017-05-29T06:46:03","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=1523"},"modified":"2017-05-29T12:16:03","modified_gmt":"2017-05-29T06:46:03","slug":"run-a-codeigniter-in-a-cron-job-using-cpanel","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/run-a-codeigniter-in-a-cron-job-using-cpanel\/","title":{"rendered":"Run a Codeigniter in a cron job using CPanel"},"content":{"rendered":"<p style=\"text-align: left\"><strong>Date Posted:29-05-2017<\/strong><\/p>\n<p style=\"text-align: left\">In this post we will explain Run a Codeigniter in a cron job using CPanelin Codeigniter<\/p>\n<p>Step 1:<br \/>\nOpen Cpanel-&gt;cronjob<\/p>\n<p>Step 2: add command text box below code<br \/>\nwget http:\/\/domainname.com\/Cronjob\/sendDailyEmail<\/p>\n<p>Step 3:create a new controller give name as Cropjob.php,Create the new\u00a0 function give name as\u00a0 as\u00a0sendDailyEmail\u00a0 here\u00a0 add the email function<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php\r\n\r\nif ( ! defined('BASEPATH')) exit('No direct script access allowed');\r\n\r\nclass Cronjob extends MY_Controller\r\n{\r\n  public function sendDailyEmail()\r\n  {\r\n      $userEmail='example@domain.com';\r\n          $subject='Test';\r\n          $config = Array(       \r\n               'mailtype' =&gt; 'html',\r\n                  'charset'  =&gt; 'utf-8',\r\n                  'priority' =&gt; '1'\r\n          );\r\n          $this-&gt;load-&gt;library('email', $config);\r\n          $this-&gt;email-&gt;set_newline(\"\\r\\n\");\r\n         \r\n              $this-&gt;email-&gt;from('your mail id', 'Test');\r\n              $data = array(\r\n                   'userName'=&gt; 'Test'\r\n                       );\r\n          $this-&gt;email-&gt;from('example@domain.in', 'Test');\r\n          $this-&gt;email-&gt;to($userEmail);  \/\/ replace it with receiver mail id\r\n          $this-&gt;email-&gt;subject($subject); \/\/ replace it with relevant subject\r\n         \r\n          $body = $this-&gt;load-&gt;view('birthday.php',$data,TRUE);\r\n          $this-&gt;email-&gt;message($body);  \r\n          $this-&gt;email-&gt;send();\r\n  }\r\n}<\/pre>\n<p>step 4:Create HTML file in view folder name as birthday.php after add following code.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"utf-8\" \/&gt;\r\n    &lt;title&gt;Codeigniter mail templates&lt;\/title&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n<div>\r\n   <div style=\"font-size: 26px;font-weight: 700;letter-spacing: -0.02em;line-height: 32px;color: #41637e;font-family: sans-serif;text-align: center\" align=\"center\" id=\"emb-email-header\"><img decoding=\"async\" style=\"border: 0;max-width: 152px\" src=\"img\/logo.png\" alt=\"\" width=\"152\" height=\"108\"><\/div>\r\n&lt;p style=\"Margin-top: 0;color: #565656;font-family: Georgia,serif;font-size: 16px;line-height: 25px;Margin-bottom: 25px\"&gt;Hey &lt;?php echo $userName;?&gt;,&lt;\/p&gt;\r\n&lt;p style=\"Margin-top: 0;color: #565656;font-family: Georgia,serif;font-size: 16px;line-height: 25px;Margin-bottom: 25px\"&gt; This is mail demo of How to send email using HTML templates in Codeigniter &lt;\/p&gt;\r\n&lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date Posted:29-05-2017 In this post we will explain Run a Codeigniter in a cron job using CPanelin Codeigniter Step 1: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[341],"class_list":["post-1523","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-codeigniter","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-oz","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1523"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1523\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}