$headers="from: Mail",$mesg,$headers); if ($str==true) { echo "Message sent ";

Similar documents
Manually Sending Mail Via Smtp Php Example

Introduction of Laravel and creating a customized framework out of its packages

Etanova Enterprise Solutions

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Laravel

[ASP.NET MVC DEVELOPMENT] March 8, Summation IT

Symfony Doctrine Build Schema From Existing Database

DevShala Technologies A-51, Sector 64 Noida, Uttar Pradesh PIN Contact us

Oh yes, wpcache comes with a dashboard wpcache is not Plugin!

Configuring Cisco Unity and Unity Connection Servers

Introduction to PHP. Handling Html Form With Php. Decisions and loop. Function. String. Array

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

Etanova Enterprise Solutions

Bitnami ProcessMaker Community Edition for Huawei Enterprise Cloud

[PHP DEVELOPMENT] February 27, Summation IT

Bitnami Dolibarr for Huawei Enterprise Cloud

Helpline No WhatsApp No.:

Automated Installation Guide for CentOS (PHP 7.x)

PHP TABLE OF CONTENTS. For Young Aspirants KARMICK. Introduction. The ABCs of PHP. Why Choose PHP As A Career?

Microsoft SQL Installation and Setup

Configure Settings and Customize Notifications on FindIT Network Probe

01 : Our Introduction

[PACKT] open source^ Kohana 3.0. Beginner's Guide. Develop professional web applications with Kohana. Jason D. Straughan

Get in Touch Module 1 - Core PHP XHTML

Joomla 3.X Global Settings Part III Server Settings

DreamFactory Security Guide

Web Programming Paper Solution (Chapter wise)

Backend Web Frameworks

Migrating from IBM Lotus Domino to Zimbra Collaboration Suite

UK SSD Business Class Web Hosting package that lets you host your websites under one account.

Unable To Access An Error Message Corresponding To Your Field Name. Codeigniter Callback

Bitnami Coppermine for Huawei Enterprise Cloud

WHITE PAPER Cloud FastPath: A Highly Secure Data Transfer Solution

Webcart Documentation

Alteryx Technical Overview

PIMCORE TRAINING GUIDE

Automation with Meraki Provisioning API

Bitnami Open Atrium for Huawei Enterprise Cloud

Case Study Ecommerce Store For Selling Home Fabrics Online

Enterprise Manager/Appliance Communication

Web Application Architectures

Wama Software Portfolio

Configuring /Text Alerts in ThorPCX SUPPORT DOCUMENT

This document contains information that will help manage various aspects of your online presence through one intuitive interface.

Prototype Report. Team No. 3. Istartonmonday.com. Team members. Operational Concept Engineer. Thammanoon Kawinfruangfukul Life Cycle Planner

Cluster Upgrade Procedure with Job Queue Migration.

MEAN & LAMP. Technical Capability Document MEAN & LAMP. our competencies : All rights reserved: DynaWEB An ADI Group Company

This Document is the property of Access UK Copyright 2014 Access UK Ltd All rights reserved Classification Restricted. Dimensions 2.

Change Schema Active Directory Password Mac Users Can't

Evaluation Guide for ASP.NET Web CMS and Experience Platforms

Working with the Seagull Framework. By Demian Turner, Seagull Systems

Certified ASP.NET Programmer VS-1025

WeChat Adobe Campaign Integration - User Guide

Project Development Steps using RP framework

Zend Framework. Zend Framework provides rich and flexible MVC components built using the object oriented features of PHP 5.

Deltek Touch Expense for Ajera. Touch 1.0 Technical Installation Guide

VMware AirWatch Database Migration Guide A sample procedure for migrating your AirWatch database

(electronic mail) is the exchange of computer-stored messages by telecommunication.

Xeretec Scan to OneDrive Secure and Convenient

The connection has timed out

PHP Composer 9 Benefits of Using a Binary Repository Manager

Deploy. A step-by-step guide to successfully deploying your new app with the FileMaker Platform

Tasktop Sync - Cheat Sheet

Adding a POP/IMAP

FULL STACK FLEX PROGRAM

Online CD Library (OCDL):

PROFESSIONAL TRAINING

The Now Platform Reference Guide

Website Backend Manual

Etanova Enterprise Solutions

Log Analyzer Reference

APPLICATION NOTE. Subject: C-more setup and functionality Date Issued: C-more functionality

WinAutomation Version 8 Release Notes

Citrix Cloud Resource Locations

Lyna Framework Documentation

PDF # SECURE LOGINS PHP USER GUIDE

Upload to your web space (e.g., UCSC) Due this Thursday 4/8 in class Deliverable: Send me an with the URL Grading:

Review. Fundamentals of Website Development. Web Extensions Server side & Where is your JOB? The Department of Computer Science 11/30/2015

Bitnami TestLink for Huawei Enterprise Cloud

Bitnami Phabricator for Huawei Enterprise Cloud

BlackBerry UEM Configuration Guide

Configuration Guide. BlackBerry UEM. Version 12.9

Qlik NPrinting. September 2018 Copyright QlikTech International AB. All rights reserved.

Azure Development Course

Jenkins: A complete solution. From Continuous Integration to Continuous Delivery For HSBC

Configuration Guide. BlackBerry UEM. Version 12.7 Maintenance Release 2

Blast Project. Release

Real Life Web Development. Joseph Paul Cohen

Server-Side Web Programming: Python (Part 2) Copyright 2017 by Robert M. Dondero, Ph.D Princeton University

Quest: Choose the ideal web platform for your business

Manual for Migrating Data from Gmail to

Bitnami DokuWiki for Huawei Enterprise Cloud

FAQ 106 How do I access and set up client applications? There are two ways to access a mailbox for sending and receiving messages:

How to use Laravel Database Migrations

LabTech Ignite Installation

Foundation Drupal 7: Learn How To Use The Drupal Framework To Quickly Build Feature-rich Websites By RJ Townsend

jetnexus Virtual Load Balancer

Set Up with Microsoft Outlook 2013 using POP3

We will provide you with your new login settings, which will be along the lines of: eg.

Management Tools. Management Tools. About the Management GUI. About the CLI. This chapter contains the following sections:

Developing Microsoft Azure Solutions (70-532) Syllabus

Transcription:

Email and Frameworks in PHP Email in PHP PHP uses Mail() function to send an email from your website. Parameters required (Receipient s email address, subject, body) Optional parameters (Header, parameters) mail (to,subject,message,headers,parameters) Though, using mail() is quiet simple, but it involves lot of considerations. You need to check the web server, SMTP, authentication etc. which makes writing mail program cumbersome. The code for simple mail function is as follows: <?php $mesg= "Welcome to e-pgpathshala"; $headers="from: bhumikagshah@gmail.com"; $str=mail("bhumikagshah@gmail.com","test Mail",$mesg,$headers); if ($str==true) { echo "Message sent "; else { echo "Message not sent";?> The above program would immediately return you Message sent, but might always not result is success.

Hence to overcome, the uncertainties we have used the phpmailer(), which is available for download on github. PHPMailer() It is a type of library which has a collection of functions that provide with building and sending email messages. It supports various ways of sending mails like mail(), qmail, direct SMTP mail etc. We would be using PHPmailer to send our E-Mail. Mail Not so user friendly You have to integrate the mail server yourself (Using SMTP has its own considerations) PHPMailer User friendly Does everything automatically Program for Sending Mail <?php require 'PHPMailer-Master/PHPMailerAutoload.php'; $mail = new phpmailer(); //spl_autoload() $mail->issmtp(); $mail->host = 'smtp.gmail.com'; $mail->smtpauth = true; // Set mailer to use SMTP // Specify main and backup SMTP servers // Enable SMTP authentication $mail->username = 'bhumikagshah@gmail.com'; // SMTP username $mail->password = 'Your Password'; // SMTP password $mail->smtpsecure = 'tls'; // Enable TLS encryption, `ssl` also accepted

$mail->port = 587; // TCP port to connect to $mail->setfrom('bhumikagshah@gmail.com', 'epgpathshahla'); $mail->addreplyto('bhumikagshah@gmail.com', 'epgpathshala'); $mail->addaddress('bhumikagshah@gmail.com'); // Add a recipient $mail->addcc('cc@example.com'); $mail->addbcc('bcc@example.com'); $mail->ishtml(true); // Set email format to HTML $bodycontent = '<h1>how to Send Email using PHP in Localhost by Bhumika </h1>'; $bodycontent.= '<p>this is the HTML email sent from localhost using PHP script by <b>bhumika</b></p>'; $mail->subject = 'Email from Localhost by Bhumika'; $mail->body = $bodycontent; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: '. $mail->errorinfo; else { echo 'Message has been sent';?>

You will also have to include Autoloader file of the part of library, which we have used on top of the program, The code of autoloader program is as follows : * PHPMailer SPL autoloader. * @param string $classname The name of the class to load */ function PHPMailerAutoload($classname) { //Can't use DIR as it's only in PHP 5.3+ $filename = dirname( FILE ).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; if (is_readable($filename)) { require $filename; if (version_compare(php_version, '5.1.2', '>=')) { //SPL autoloading was introduced in PHP 5.1.2 if (version_compare(php_version, '5.3.0', '>=')) { spl_autoload_register('phpmailerautoload', true, true); else { else { /** spl_autoload_register('phpmailerautoload'); * Fall back to traditional autoload for old PHP versions * @param string $classname The name of the class to load */ function autoload($classname) { PHPMailerAutoload($classname);

Test Mail Mail.php <?php $mail=new PHPMailer(); $mail->smtpdebug=0; $mai ->IsSMTP(); $mail->smtpauth=true; $mail->smtpsecure='ssl'; $mail->host="smtp.gmail.com"; $mail->port=587; $mail->ishtml(true); $mail->username="bhumikagshah@gmail.com"; $mail->password="your Password"; $mail->setfrom("bhumikagshah@gmail.com"); $mail->subject="this is My Email subject"; $mail->body="this is Body of send email"; $mail->addaddress("bhumikagshah@gmail.com"); if(!$mail->send()) { echo "Mail Error:".$mail->ErrorInfo; else { echo "Message has been sent";?>

Troubleshooting Mail issues Gmail Security settings You will have to edit, Gmail security settings so as to allow mail from programs. Visit : accounts.google.com

After allowing lesser secure apps, you will be able to get mail from your program Troubleshooting Email program: Check Gmail security Check SMTP Php.ini Sendmail.ini

Frameworks in PHP Provides structured way, with built-in modules : Frameworks give users a basic structure with built in modules to develop applications faster and with much ease Uses MVC Architecture: Frameworks in PHP use MVC architecture, wherein the business logic exists independently of data layer and presentation layer. Enforces coding standards and development guidelines : The framework enforces the development standards and development guidelines which helps in standardizing the development process Improved stability and Quality : Dividing modules in parts increases the development speed and hence improves scalability and quality Easy to upgrade and maintain developed application Good community support Types of Frameworks for PHP Laravel Codeigniter CakePHP Symfony Zend Framework We will take an overview of each of the Framework and CodeIgniter Framework in detail. LARAVEL Popularly known as Framework for Web Artisans, Laravel is open source framework which follows MVC architecture and consists of simple toolkit which enables developers to create complex web applications easily. Additionally, it also provides robust security features. It has a huge ecosystem with instant hosting and deployment CakePHP Already a decade old, CakePHP is designed to ease the common web development tasks and consists of all-in-one toolbox. It can exist isolated and also as a whole. The rich set of libraries make coding easy for developers Symfony Popularly known as PHP web application framework, it is a set of reusable PHP components/libraries. It helps in reducing repetitive tasks and has a low performance overhead. It has set of tools and a development methodology.

Zend Framework It is an object oriented framework which is basically a collection of professional PHP packages. It has a collection of 60+ packages. Due to its configuration options, it is not recommended for small projects, but works best for the complex projects. Comparative analysis PHP Frameworks Laravel Symfony CodeIgniter CakePHP Zend Framework Started in 2011 2005 2006 2005 2006 Latest Version number 5.4 3.2 3.1.3 3.4 2.5 Features Database agnostic migration Schema builder Toolkit that includes ORM queue library routing methods, authentication facilities YAML Event dispatcher Dependency Injector Templating engine Application profiling Template engine class Query builder Data encryption Authenticati on facilities Console tools Controllers Modeless forms Plugins End-to-end encryption Package dependency manager Continuous integration service Prominent projects Deltanet Travel World Walking FusionInvoice Asgard CMS Drupal Laravel phpbb OROCRM Buffer Small SEO Tools BMW Express Sainsburys Bank BBC BNP PARIBAS Cisco Webex License MIT MIT MIT MIT New BSD Comparative analysis from: https://www.vtrio.com/blog/top-5-php-frameworks-of-2017/

Codeigniter It is a light weight PHP framework. Code igniter is known for its flexibility and easy installation. CodeIgniter is popular among beginners and developers as it is very easy to learn and has a rich set of APIs. The crud (create/read/update/delete) functionality is well integrated hence database related tasks are implemented easily and quickly. Codeigniter Framework CodeIgniter (Sample Project)

Database.php Program: Leave application