0% found this document useful (0 votes)
100 views

Email Sem6 Bca

Email is a method of transferring digital messages over the internet using client-server protocols. Common email protocols include POP3 for receiving emails, IMAP for accessing emails stored on the server, and SMTP for delivering emails. An email consists of a header containing sender, recipient, and other metadata and an optional message body containing the email contents. PHP's mail() function can be used to send emails from a script by specifying the recipient, subject, and message.

Uploaded by

aishwarya saji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Email Sem6 Bca

Email is a method of transferring digital messages over the internet using client-server protocols. Common email protocols include POP3 for receiving emails, IMAP for accessing emails stored on the server, and SMTP for delivering emails. An email consists of a header containing sender, recipient, and other metadata and an optional message body containing the email contents. PHP's mail() function can be used to send emails from a script by specifying the recipient, subject, and message.

Uploaded by

aishwarya saji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Email

• Email is the fastest method of transferring digital messages


over the internet.
• Email systems are based on client server architecture.
• Originally email was a text only communication medium then
it was extended to carry multi media content attachments
called MIME.
• Email server:
• This is a machine or group of machines to host the email
transportation.
• The server accepts, forwards, delivers and store messages.
• When the user logs in the client start sending request, the
server provides latest information.
• Various protocols are used to send email.
• A protocol is a method used at both end of communication
channel.
• The protocol define a common standard, agreed by both in
order to properly transmit information.
• The mail client and mail server can exchange information with
each other using different protocol like IMAP, POP3, SMTP
and HTTP.
POP3 (Post office Protocol3)

• POP3 (Post Office Protocol 3) is the most recent version of a


standard protocol for receiving e-mail.
• POP3 is a client/server protocol in which e-mail is received
and held for you by your Internet server.
• Using this protocol all email messages are downloaded from
the mail server to your local computer.
• The server can keep copies of email on it.
• Once messages are downloaded internet connection is not
required which reduces internet charges.
• But while downloading the message a lot of messages are also
copied on the local computer.
• When the message is downloaded to the client machine the
copy from server gets deleted.
• This makes to access email from that local computer and not
from any computer using internet.
• The POP3 server requires the login procedure i.e an account
name and a password.
• When you check email your client connects to the POP3
server using port 110 through telenet.
• The POP3 server maintain a text file one for each email
account.
• On the successful login the POP3 server opens users text file
and allow accessing it.
IMAP( Internet Message Access Protocol)
• IMAP is a standard protocl for accessing email from your
server.
• It is a client server protocol in which email is recived and
stored by your internet server.
• With IMAP user email stay on email server.
• This makes it possible to access your email from anywhere.
• The user can also create and manipulate folders or mailboxes
on the server.
• IMAP supports both online and offline modes of operations.
SMTP(Simple Mail Transfer Protocol)
• The SMTP protocol is used to deliver email to the recipients
mail server.
• The SMTP protocol is used to send emails not to receive them.
• In the OSI reference model SMTP would be an application
layer protocol.
• If mail delivery fail send mail will queue mail messages and
retry to delivery that mail later.
• Whenever we send mail an email client communicates with
the SMTp server to handle the sending.
• The SMTP server on your host may have conversation with
other SMTP server to deliver the email.

HTTP
• HTTp defines how messages are formatted and transmitted
and what action web server and browser should take in
response to various commands.
• HTTp is used to retrieve the document.
• HTTp is called a stateless protocol because each command is
executed independently.
• HTTP defines a set of rules regarding how messages and other
data should be formatted and exchanged between server and
browser.
Structure of an email message
• An email message consist of two compoents
• 1) Message header
• 2)Message body
• The message header contains the basic information as senders
email address and recipents address.
• It stores additional information as a subject header , date etc.

Header field Description


Trace It is used when msg is resend
From The senders email address
To The recipients address

Date The date and time when the msg is sent


• Message body:
• Is the email contents.
• It can be any text
• This field is optional one can send msg without text.
Sending Email with PHP
• Mail() is used to send email through PHp script.
• It return true or false
• Syntax:
• Mail(string $to, string $subject, string $message[ ,string
$additional_header [, string $additonl_parameters]])
• To: single or multiple receivers of the mail. This is an email
address
• Subject: subject of the email to be sent
• Message: message to be sent
• Additional_header: it is an optional parameters. Used to add
CC or BCC
• Additional_parameters: is an optional parameters
• Even when mail() function executes properly, we cannot
assure if the email has received at the other end.
• It depends on the availability of the receivers web servers and
correctness of mail address.
• <?php
[email protected]// receivers email id
• $subject = ‘email from php’
• $message = ‘hi’
• $headers = ‘from :[email protected]
• $r = @mail($to,$subject,$message,$headers);
• Echo $r ? “mail delivered successfully”: “mail delivery fails”;
• ?>
• Email ID validation and verification:
Validation is the process in which we accept data from user
and check it with some predefined stndatrd.
• Validation is used to validate or check if the data follows
certain qualifications.
• Validation donot change the data itself.
• In PHP there are different ways to validate email address.
• 1) using filters
• 2)using eregi()
• Using filters:
• FILTER_VALIDATE_EMAIL
• This is a filter which validate the email.
• <?php
• $e = ‘[email protected]
• $e2= ‘[email protected]
• If(filter_var($e, FILTER_VALIDATE_EMAIL))
• {
• ECHO “this email is looks valid’
• }
• ?>
• Using eregi()
• This function verifies whether the input string satisfies the
regular expression defined by pattern
• If(! Eregi(“ ^[_a-z0-9-]+(\_a-z)-9-)+*@[a-z0-9-]+(\.a-z0-9-]+)
• *(\.[a-z] {2,3})$”,$email))
• {
• Echo “invalid email”;
• }
• Else
• {
• Echo “valid email”
• }
• Lets divide the regular expression into two parts.
• First part till @ and second part is from @ till end of the
regular expression.
• First part ^[_a-z0-9-]+(\_a-z)-9-)+*@
• ^[_a-z0-9-]+ there must be at least 1 character between 1 and z
or between 0-9 or ‘_’.
• (\_a-z)-9-)+*@
• The first character group will be followed by 0 or more
character group which always begin with a.
Second part:
@[a-z0-9-]+(\.a-z0-9-]+)*(\.[a-z] {2,3})$
@ means after first part this character is mandatory exactly once.
a-z0-9-]+(\.a-z0-9-]+) as before.
(\.[a-z] {2,3})$ this means at the end of the email string there
must be 2 or 3 character long substring.
And before it a ‘.’ is mandatory.

You might also like