GithubHelp home page GithubHelp logo

email-sending-php's Introduction

email-sending app using PHP

#This is an application in PHP for sending email from the contact form of a website. When the user visits the contact page of the website, they can enter details about the email such as their name, the subject of the email, the sender's email address and the message. When they've finished filling the form, they can click the send button and the mail will be sent to the specified email address.

Note:

Sending email using the mail() function only works when there is internet connection. Until your application is hosted on a server on the internet before it can send an email.

A basic usage of the mail() function looks like this:

""

===>>> The above piece of code will actually send an email to '[email protected]' with subject 'My Subject' and message 'Hey there! How you doin'' when the script is executed.

PHP's mail() function has the following signature:

bool mail ( string $to , string $subject , string $message, string $headers );

1.) $to

Receiver's email address. As specified in the PHP docs, the receiver's email address should take the following formats

=> [email protected] ==> [email protected], [email protected] (Sending to multiple users) ===> User [email protected] (Specifying the user's username)

2.) $subject:

The subject of the email to be sent

3.) $message:

The message. Each line should contain no more than 70 characters. Each line should be separated with a CRLF (\r\n). You could solve this simply by wrapping the message text around the PHP wordwrap() function. Like so:

$message = wordwrap($message, 70);

4.) $headers:

This one is optional. But If you want to do some styling on the email you send, you must specify the Content-Type in the header as text/html;charset=UTF-8 to tell email clients to parse the email as HTML.

Images directory contains a screenshot of email i sent

Thank you for reading

email-sending-php's People

Contributors

joy-joel avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.