{"id":9371,"date":"2022-04-12T08:05:27","date_gmt":"2022-04-12T12:05:27","guid":{"rendered":"https:\/\/kb.n0c.com\/?post_type=ht_kb&#038;p=9371"},"modified":"2025-03-04T08:55:42","modified_gmt":"2025-03-04T13:55:42","slug":"install-composer-and-phpmailer-on-n0c","status":"publish","type":"ht_kb","link":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/","title":{"rendered":"How to Install Composer and PHPMailer"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>This article explains how to send emails with a PHP application using <strong>PHPMailer<\/strong>. Before doing so, however, you must use <strong>Composer<\/strong> to download PHPMailer and automatically create an autoloader file.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\"><strong>Note:<\/strong> Users often do not know how to proceed, hence this article.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\"><meta charset=\"utf-8\"><strong>Note<\/strong>: <meta charset=\"utf-8\">The&nbsp;<a href=\"https:\/\/kb.n0c.com\/en\/glossary\/\" data-type=\"URL\" data-id=\"https:\/\/kb.n0c.com\/en\/glossary\/\">Glossary<\/a>&nbsp;contains explanations on multiple topics and can be consulted to clarify certain terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Installation of Composer<\/h2>\n\n\n\n<p>First of all, you need to connect to the N0C account via SSH (<a href=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-create-an-ssh-key-and-connect-to-an-account\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Create an SSH Key and Connect to an Account Remotely<\/a>). Then, you can proceed with the installation.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\"><strong>Note:<\/strong> In the following commands, &#8220;user&#8221; must be replaced by the username of the N0C account in question.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start by entering the following commands:<\/li>\n<\/ol>\n\n\n\n<p><code>php -r \"readfile('https:\/\/getcomposer.org\/installer');\" &gt; composer.php<\/code><\/p>\n\n\n\n<p><code>php composer.php<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>The following message will appear:<\/li>\n<\/ol>\n\n\n\n<p>&#8220;<em>All settings correct for using Composer<br>Downloading&#8230;<br>Composer (version 2.3.4) successfully installed to: \/home\/zjpqumjq\/composer.phar<br>Use it: php composer.phar<\/em>&#8220;<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Type this line of code:<\/li>\n<\/ol>\n\n\n\n<p><code>nano .bash_profile<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Add this line of code:<\/li>\n<\/ol>\n\n\n\n<p><meta charset=\"utf-8\"><code><meta charset=\"utf-8\">alias composer=\"php \/home\/user\/composer.phar\"<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Finally, reload the bash_profile, which will allow us to invoke the command without having to specify its path:<\/li>\n<\/ol>\n\n\n\n<p><meta charset=\"utf-8\"><code><meta charset=\"utf-8\">source ~\/.bash_profile<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\">\n<li>Now you just have to type &#8220;<strong>composer<\/strong>&#8220;:<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"170\" src=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png\" alt=\"\" class=\"wp-image-18531\" srcset=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png 1024w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1-300x50.png 300w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1-768x128.png 768w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1-50x8.png 50w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1-60x10.png 60w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1-100x17.png 100w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Step 2: Installation of PHPMailer<\/h2>\n\n\n\n<p>Make sure that you have installed <strong>Composer<\/strong> and that you are still connected via SSH, as explained before.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create the desired folder for PHPMailer:<\/li>\n<\/ol>\n\n\n\n<p><code>mkdir mail_app<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Move to the active current working directory (CWD):<\/li>\n<\/ol>\n\n\n\n<p><code>cd mail_app<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Install PHPMailer with the Composer command:<\/li>\n<\/ol>\n\n\n\n<p><code>composer require phpmailer\/phpmailer<\/code><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Here is the output of Composer for the installation of php_mailer:<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"846\" height=\"449\" src=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1.png\" alt=\"\" class=\"wp-image-18537\" srcset=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1.png 846w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1-300x159.png 300w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1-768x408.png 768w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1-50x27.png 50w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1-60x32.png 60w, https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_2-1-100x53.png 100w\" sizes=\"auto, (max-width: 846px) 100vw, 846px\" \/><\/a><\/figure><\/div>\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Here, there is nothing to reload normally. It is in the script that we must indicate the path to PHPMailer:<\/li>\n<\/ol>\n\n\n\n<p><code>\/home\/user\/mail_app\/vendor\/phpmailer\/phpmailer<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This article explains how to send emails with a PHP application using PHPMailer. Before doing so, however, you must use Composer to download PHPMailer and automatically create an autoloader file. Step 1: Installation of Composer First of all, you need to connect to the N0C account via SSH (How&#8230;<\/p>\n","protected":false},"author":4,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[163],"ht-kb-tag":[493,494],"class_list":["post-9371","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-languages","ht_kb_tag-composer-2","ht_kb_tag-phpmailer-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Composer and PHPMailer - N0C KB<\/title>\n<meta name=\"description\" content=\"Sending emails with a PHP application using PHPMailer.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Composer and PHPMailer - N0C KB\" \/>\n<meta property=\"og:description\" content=\"Sending emails with a PHP application using PHPMailer.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/\" \/>\n<meta property=\"og:site_name\" content=\"N0C KB\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-04T13:55:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/\",\"name\":\"How to Install Composer and PHPMailer - N0C KB\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kb.n0c.com\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/Composer_1-1024x170-1.png\",\"datePublished\":\"2022-04-12T12:05:27+00:00\",\"dateModified\":\"2025-03-04T13:55:42+00:00\",\"description\":\"Sending emails with a PHP application using PHPMailer.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/Composer_1-1024x170-1.png\",\"contentUrl\":\"https:\\\/\\\/kb.n0c.com\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/Composer_1-1024x170-1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/install-composer-and-phpmailer-on-n0c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/kb.n0c.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Install Composer and PHPMailer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/#website\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/\",\"name\":\"N0C KB\",\"description\":\"Official documentation of the N0C hosting platform\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kb.n0c.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Composer and PHPMailer - N0C KB","description":"Sending emails with a PHP application using PHPMailer.","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:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Composer and PHPMailer - N0C KB","og_description":"Sending emails with a PHP application using PHPMailer.","og_url":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/","og_site_name":"N0C KB","article_modified_time":"2025-03-04T13:55:42+00:00","og_image":[{"url":"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/","url":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/","name":"How to Install Composer and PHPMailer - N0C KB","isPartOf":{"@id":"https:\/\/kb.n0c.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/#primaryimage"},"image":{"@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/#primaryimage"},"thumbnailUrl":"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png","datePublished":"2022-04-12T12:05:27+00:00","dateModified":"2025-03-04T13:55:42+00:00","description":"Sending emails with a PHP application using PHPMailer.","breadcrumb":{"@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/#primaryimage","url":"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png","contentUrl":"https:\/\/kb.n0c.com\/wp-content\/uploads\/2025\/03\/Composer_1-1024x170-1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/install-composer-and-phpmailer-on-n0c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/kb.n0c.com\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/kb.n0c.com\/en\/knowledge-base\/"},{"@type":"ListItem","position":3,"name":"How to Install Composer and PHPMailer"}]},{"@type":"WebSite","@id":"https:\/\/kb.n0c.com\/#website","url":"https:\/\/kb.n0c.com\/","name":"N0C KB","description":"Official documentation of the N0C hosting platform","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kb.n0c.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/9371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/comments?post=9371"}],"version-history":[{"count":26,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/9371\/revisions"}],"predecessor-version":[{"id":18539,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/9371\/revisions\/18539"}],"wp:attachment":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/media?parent=9371"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb-category?post=9371"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=9371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}