{"id":16497,"date":"2022-10-19T05:56:55","date_gmt":"2022-10-19T00:26:55","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/"},"modified":"2022-10-19T05:56:55","modified_gmt":"2022-10-19T00:26:55","slug":"solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/","title":{"rendered":"[Solved] PHP for send a email for more than one recipients automatically at a given time"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-38342490\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"38342490\" data-parentid=\"38342248\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>This script should solve your immediate problem.<\/p>\n<p>The first block, which builds $msg, is based upon the code you provided since I don&#8217;t have enough insight into your database setup to write something more modern. mysql_fetch_array and the whole group of mysql_ functions were deprecated in PHP 5.5.0 (see <a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/php.net\/manual\/en\/function.mysql-fetch-array.php\">http:\/\/php.net\/manual\/en\/function.mysql-fetch-array.php<\/a>, <a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/php.net\/manual\/en\/function.mysql-query.php\">http:\/\/php.net\/manual\/en\/function.mysql-query.php<\/a>, etc.) and should no longer be used. But since you&#8217;ve opened the database this way, I use it in the second code block too. Please consider getting comfortable with the PDO class, which is a vast improvement and will make your PHP\/SQL a lot more stable (<a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/php.net\/manual\/en\/class.pdostatement.php\">http:\/\/php.net\/manual\/en\/class.pdostatement.php<\/a>).<\/p>\n<pre><code>$msg = \"&lt;table border=\"1\" cellpadding='3' cellspacing='0'&gt; \";\n$msg .= \"&lt;tr&gt; &lt;th&gt;Date&lt;\/th&gt;&lt;th&gt;Line&lt;\/th&gt; &lt;th&gt;Style No&lt;\/th&gt; &lt;th&gt;PO No&lt;\/th&gt;&lt;th    bgcolor=\"#CCCCFF\"&gt;Order Qty&lt;\/th&gt;&lt;th&gt;Line Out&lt;\/th&gt;&lt;th&gt;Final QC Out&lt;\/th&gt;&lt;th&gt;Iron Out&lt;\/th&gt;&lt;th&gt;Refinal Out&lt;\/th&gt;&lt;th&gt;Packing In&lt;\/th&gt;&lt;th&gt;Warehouse In&lt;\/th&gt;\";\nwhile ( $row10 = mysql_fetch_array( $result10 ) ) {\n  $msg .= \"&lt;tr&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['wdate'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt; Line\" . $row10['line'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['style_no'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['po_no'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td bgcolor=\"#CCCCFF\"&gt;\" . $row10['order_qty'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['Line_Out'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['Final_QC_Out'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['Iron_Out']. \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['Refinal_Out'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['Packing_In'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;td&gt;\" . $row10['Warehouse_In'] . \"&lt;\/td&gt;\";\n  $msg .= \"&lt;\/tr&gt;\";\n}\n$msg .= \"&lt;\/table&gt;\";\n\n$query = \"SELECT email FROM email_tbl\";\nif ( !$result = mysql_query( $query ) ) {\n  $message=\"Invalid query: \" . mysql_error() . \"\\n\";\n  $message .= 'Whole query: ' . $query;\n  die($message);\n}\n$to = '';\nwhile ( $row = mysql_fetch_assoc( $result ) ) {\n  $to .= $row['email'] . ',';\n}\nrtrim( $to, \",\" );\nmysql_free_result( $result );\n\n$subject = \"Morning email from Gayan\";\n\n$headers=\"From: webmaster@example.com\" . \"\\r\\n\" .\n   'Reply-To: webmaster@example.com';\n\nif ( mail( $to, $subject, $msg, $headers ) ) {\n  echo \"Email sent successfully&lt;br&gt;\";\n} else {\n  echo \"ERROR sending email&lt;br&gt;\";\n}\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">8<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved PHP for send a email for more than one recipients automatically at a given time <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] This script should solve your immediate problem. The first block, which builds $msg, is based upon the code you provided since I don&#8217;t have enough insight into your database setup to write something more modern. mysql_fetch_array and the whole group of mysql_ functions were deprecated in PHP 5.5.0 (see http:\/\/php.net\/manual\/en\/function.mysql-fetch-array.php, http:\/\/php.net\/manual\/en\/function.mysql-query.php, etc.) and should &#8230; <a title=\"[Solved] PHP for send a email for more than one recipients automatically at a given time\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\" aria-label=\"More on [Solved] PHP for send a email for more than one recipients automatically at a given time\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[339],"class_list":["post-16497","post","type-post","status-publish","format-standard","hentry","category-solved","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] PHP for send a email for more than one recipients automatically at a given time - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] PHP for send a email for more than one recipients automatically at a given time - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] This script should solve your immediate problem. The first block, which builds $msg, is based upon the code you provided since I don&#8217;t have enough insight into your database setup to write something more modern. mysql_fetch_array and the whole group of mysql_ functions were deprecated in PHP 5.5.0 (see http:\/\/php.net\/manual\/en\/function.mysql-fetch-array.php, http:\/\/php.net\/manual\/en\/function.mysql-query.php, etc.) and should ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-19T00:26:55+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] PHP for send a email for more than one recipients automatically at a given time\",\"datePublished\":\"2022-10-19T00:26:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\"},\"wordCount\":157,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"php\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\",\"name\":\"[Solved] PHP for send a email for more than one recipients automatically at a given time - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-10-19T00:26:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] PHP for send a email for more than one recipients automatically at a given time\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] PHP for send a email for more than one recipients automatically at a given time - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] PHP for send a email for more than one recipients automatically at a given time - JassWeb","og_description":"[ad_1] This script should solve your immediate problem. The first block, which builds $msg, is based upon the code you provided since I don&#8217;t have enough insight into your database setup to write something more modern. mysql_fetch_array and the whole group of mysql_ functions were deprecated in PHP 5.5.0 (see http:\/\/php.net\/manual\/en\/function.mysql-fetch-array.php, http:\/\/php.net\/manual\/en\/function.mysql-query.php, etc.) and should ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/","og_site_name":"JassWeb","article_published_time":"2022-10-19T00:26:55+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] PHP for send a email for more than one recipients automatically at a given time","datePublished":"2022-10-19T00:26:55+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/"},"wordCount":157,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["php"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/","url":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/","name":"[Solved] PHP for send a email for more than one recipients automatically at a given time - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-10-19T00:26:55+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-php-for-send-a-email-for-more-than-one-recipients-automatically-at-a-given-time\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] PHP for send a email for more than one recipients automatically at a given time"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/16497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=16497"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/16497\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=16497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=16497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=16497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}