

= “Content-Type: multipart/mixed boundary=\””. a random hash will be necessary to send mixed content $content = chunk_split(base64_encode($content)) $mailto = ' ' //the email which u want to recv this email $fromemail = ' ' //if u dont have an email create one on your cpanel Mail send … ERROR!Array ( => 2 => file_get_contents(): Filename cannot be empty => /home/servicen/public_html/mailer.php => 21 )

Now, if you have filled in all the correct data, you should be able to run this script in your browser and send mail to the recipient.

Well done! You’ve completed this tutorial. $ mailer-> Body = 'This is a SAMPLE email sent through PHPMailer' Įcho "EMAIL SENDING FAILED. $ mailer-> addAddress( ' ', 'Name of recipient') $ mailer-> setFrom( ' ', 'Name of sender') For local development keep the $developmentMode variable set to true For live server change the $developmentMode variable to false This code can be used on your local server or a live production environment. Once you have switched out the example text, make sure to select the right development mode. But before running this code, make sure to change some of the example text we used below with your own information. That’s it! If you don’t have one already, composer will create your “vendor” directory and populate your autoload file. You may be excited to get this code into your app, but first you need to make sure you’ve installed the necessary code library.įor this example, we’re going to be installing PHPMailer with Composer, since that is the preferred method for a great many PHP developers. Looking for a top-notch dedicated server host? You’ve come to the right place.īelow, we’ll give you a quick and easy example of a working script you can use in your local development environment or live on your InMotion Hosting server. And it’s open-source.įor more information about PHPMailer, or to contribute, check out the PHPMailer GitHub page. PHPMailer is a highly popular, actively developed email-sending library for PHP.
