{"id":132,"date":"2011-12-24T14:56:48","date_gmt":"2011-12-24T14:56:48","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=132"},"modified":"2022-02-17T07:14:05","modified_gmt":"2022-02-17T07:14:05","slug":"sending-email","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/email\/sending-email","title":{"rendered":"Sending Email"},"content":{"rendered":"\n<p>To send an email in php use the mail function<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bool mail ( string $to , string $subject , string $message &#91;, string $additional_headers &#91;, string $additional_parameters ]] )<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Working example<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>    $to = \"info@somedomain.com\";\n    $from_header = \"From: auto@\" . $_SERVER&#91;'HTTP_HOST'];    \/\/Uses host domain name\n    \/\/$from_header = \"From: \" . $Email;\n    $subject = \"MY EMAIL SUBJECT\";\n    $body = \"Some text\";\n    $body .= \"Some more text\";\n    if (mail($to, $subject, $body, $from_header))\n    {\n          echo(\"Message successfully sent!&lt;br \/>\");\n    }\n    else\n    {\n          echo(\"Message delivery failed...&lt;br \/>\");\n    }<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">PHPMailer<\/h4>\n\n\n\n<p>Great when you want to send email via a SMTP server (e.g. googlemail), attach files to emails, etc<br>Download from <a href=\"http:\/\/phpmailer.worxware.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/phpmailer.worxware.com\/<\/a><br>Copy class.phpmailer.php, class.pop3.php and class.smtp.php into your site (e.g. in a folder called phpmailer) and use one of their example files as the basis to send email.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To send an email in php use the mail function Working example PHPMailer Great when you want to send email via a SMTP server (e.g. googlemail), attach files to emails, etcDownload from http:\/\/phpmailer.worxware.com\/Copy class.phpmailer.php, class.pop3.php and class.smtp.php into your site (e.g. in a folder called phpmailer) and use one of their example files as the [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-email"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":8,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":2793,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/132\/revisions\/2793"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}