Skip to main content

Posts

Showing posts with the label Server

Send Email via SMTP Server in PHP using PHPMailer

Send email from the script is the most used feature for the web application. Basically, mail() function in PHP is used to send email from the PHP script . When you sending email using the PHP mail() function, the mail is sent from your web server. Sometimes it may cause issues on sending an email and fails to deliver mail to the recipient. With SMTP you can overcome this issue, SMTP is the most recommended way to send email from the PHP script. When you send an email via SMTP , email is sent from the mail server rather than the web server. The easiest way to send email in PHP with SMTP is to use PHPMailer library. PHPMailer provides an ability to send email via SMTP server in PHP. Various configuration options of PHPMailer library allow you to send a text email, HTML email, and attachments. In this tutorial, you’ll show how you can send HTML email with SMTP in PHP using PHPMailer. You can use the following example script to send SMTP mail using PHPMailer library. Send HTML Email vi...

Connect and Handle Files in FTP Server using PHP

Upload file to the server via FTP is an essential task for every web developers. There are many FTP clients are available for handling files on FTP server. But if you want to connect FTP server by the script, you can use PHP to handle files in FTP server . PHP provides various functions to work with FTP server. In this tutorial, show you how to connect FTP server using PHP and the most required functionality to handling files on FTP server with PHP . Connect and Login to the FTP Server At first, connect to the FTP server using ftp_connect() function. Once the FTP connection is created, use ftp_login() function to login to the FTP server by FTP username and password. // FTP server details $ftpHost = 'ftp.example.com'; $ftpUsername = 'ftpuser'; $ftpPassword = '*****'; // open an FTP connection $connId = ftp_connect($ftpHost) or die("Couldn't connect to $ftpHost"); // try to login if(@ftp_login($connId, $ftpUsername, $ftpPassword)){ echo ...