SlideShare ist ein Scribd-Unternehmen logo
1 von 19
`````
INDO GLOBAL COLLEGE OF ENGIMEERING
ABHIPUR (MOHALI)
E-MAIL SENDING SOFTWARE
Submitted in partial fulfillment of the
Requirements for the award of
Degree of Bachelor of Technology in Computer Science Engineering
SUBMITTED TO :
Er. Parveen Saini Submitted By :-
Name :Vishal Sharma
Roll No. 15220
University Roll No. 1510185
Department of Computer Science & Engineering
PUNJAB TECHNICAL UNIVERSITY
JALANDHER(PUNJAB)
DECLARATION
I hereby declare that the project entitled “E-MAIL SENDING SOFTWARE” submitted for the
B.Tech( Computer Science Engineering) degree is the original work and the project has not
formed for the basic for the award of any other degree, diploma, fellowship other any other
similar titles.
Signature of the Student :-
Place:
Date:
CERTIFICATE
This is to certify that the project titled "E-MAIL SENDING SOFTWARE” is the bona
fide work carried out by VISHAL SHARMA student of B.TECH(CSE) of Indo Global College
of Engineering, Abhipur (Mohali) affiliated to Punjab Technical University, Jalandhar,
Punjab(India) during the academic year 2017-18, in partial fulfillment of the requirements for the
award of the degree of Bachelor of Technology(Computer Science Engineering) and that the
project has not formed the basis for the award previously of any other degree, any other similar
title.
Signature of Guide :-
Place:
Date:
CONTENTS
 INTRODUCTION …………………………………………………………………
.
 OBJECTIVE…………………………………………………………………………
 TECHNOLOGY USED………………………………………………………………
 METHEDOLOGY……………………………………………………………………
 CODING & RESULT…………………………………………………………………
1 INTRODUCTION :
Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people
using electronic devices. Invented by Ray Tomlinson, email first entered limited use in the 1960s
and by the mid-1970s had taken the form now recognized as email. Email operates
across computer networks, which today is primarily the Internet. Some early email systems
required the author and the recipient to both be online at the same time, in common with instant
messaging. Today's email systems are based on a store-and-forward model. Email serversaccept,
forward, deliver, and store messages. Neither the users nor their computers are required to be
online simultaneously; they need to connect only briefly, typically to a mail server or
a webmail interface, for as long as it takes to send or receive messages.
Computer based mail and messaging became possible with the advent of time-sharing computers
in the early 1960s, and informal methods of using shared files to pass messages were soon
expanded into the first mail systems. Most developers of early mainframes and minicomputers
developed similar, but generally incompatible, mail applications. Over time, a complex web of
gateways and routing systems linked many of them. Many US universities were part of
the ARPANET (created in the late 1960s), which aimed at software portability between its systems.
That portability helped make the Simple Mail Transfer Protocol (SMTP) increasingly influential.
SMTP defines the trace information of a message, which is also saved in the header using the
following two fields:
• Received: when an SMTP server accepts a message it inserts this trace record at the top of the
header (last to first).
• Return-Path: when the delivery SMTP server makes the final delivery of a message, it inserts
this field at the top of the header.
2.OBJECTIVE
A e-mail sending programme where host send the mail to receiver using SMTP ,a Python
module.
3.TECHNOLOGY USED
Python (programming language)
Python is an interpreted high-level programming language for general-purpose programming.
Created by Guido van Rossum and first released in 1991, Python has a design philosophy that
emphasizes code readability, notably using significant whitespace. It provides constructs that enable
clear programming on both small and large scales.
Python features a dynamic type system and automatic memory management. It supports
multiple programming paradigms, including object-oriented, imperative, functional and procedural,
and has a large and comprehensive standard library.
Python interpreters are available for many operating systems. CPython, the reference
implementation of Python, is open sourcesoftware and has a community-based development
model, as do nearly all of Python's other implementations. Python and CPython are managed by
the non-profit Python Software Foundation.
Python 2.0 was released on 16 October 2000 with many major new features, including a cycle-
detecting garbage collector and support for Unicode.
Python 3.0 was released on 3 December 2008. It was a major revision of the language that is not
completely backward-compatible. Many of its major features were backported to Python
2.6.x[38] and 2.7.x version series. Releases of Python 3 include the 2to3 utility, which automates
(at least partially) the translation of Python 2 code to Python 3.
Python 2.7's end-of-life date was initially set at 2015 then postponed to 2020 out of concern that a
large body of existing code could not easily be forward-ported to Python 3. In January 2017,
Google announced work on a Python 2.7 to Go transcompiler to improve performance under
concurrent workloads.
MODULE UESD:
SMTP
The Simple Mail Transfer Protocol (SMTP) handles sending and routing email between mail
servers.
The smtplib module defines an SMTP client session object that can be used to send mail to any
Internet machine with an SMTP listener daemon.
An SMTP instance encapsulates an SMTP connection. It has methods that support a full repertoire
of SMTP operation. If the optional host and port parameters are given, the
SMTP connect() method is called with those parameters during initialization. For normal use, you
should only require the initialization/connect, sendmail(), and quit() methods.
An SMTP_SSL instance behaves exactly the same as instances of SMTP. SMTP_SSL should be used
for situations where SSL is required from the beginning of the connection and using starttls() is
not appropriate. If host is not specified, the local host is used. If port is zero, the standard SMTP-
over-SSL port (465) is used. The optional
arguments local_hostname, timeout and source_address have the same meaning as they do in
the SMTP class. context, also optional, can contain a SSLContext and allows configuring various
aspects of the secure connection.
SMTP Objects
An SMTP instance has the following methods:
SMTP.set_debuglevel(level)
Set the debug output level. A value of 1 or True for level results in debug messages for
connection and for all messages sent to and received from the server. A value of 2
for level results in these messages being timestamped.
Changed in version 3.5: Added debuglevel 2.
SMTP.docmd(cmd, args='')
Send a command cmd to the server. The optional argument args is simply concatenated to the
command, separated by a space.
This returns a 2-tuple composed of a numeric response code and the actual response line
(multiline responses are joined into one long line.)
In normal operation it should not be necessary to call this method explicitly. It is used to
implement other methods and may be useful for testing private extensions.
If the connection to the server is lost while waiting for the reply, SMTPServerDisconnected will be
raised.
SMTP.connect(host='localhost', port=0)
Connect to a host on a given port. The defaults are to connect to the local host at the standard
SMTP port (25). If the hostname ends with a colon (':') followed by a number, that suffix will be
stripped off and the number interpreted as the port number to use. This method is automatically
invoked by the constructor if a host is specified during instantiation. Returns a 2-tuple of the
response code and message sent by the server in its connection response.
SMTP.helo(name='')
Identify yourself to the SMTP server using HELO. The hostname argument defaults to the fully
qualified domain name of the local host. The message returned by the server is stored as
the helo_resp attribute of the object.
In normal operation it should not be necessary to call this method explicitly. It will be implicitly
called by the sendmail() when necessary.
SMTP.ehlo(name='')
Identify yourself to an ESMTP server using EHLO. The hostname argument defaults to the fully
qualified domain name of the local host. Examine the response for ESMTP option and store them
for use by has_extn(). Also sets several informational attributes: the message returned by the
server is stored as the ehlo_resp attribute, does_esmtp is set to true or false depending on
whether the server supports ESMTP, and esmtp_features will be a dictionary containing the
names of the SMTP service extensions this server supports, and their parameters (if any).
Unless you wish to use has_extn() before sending mail, it should not be necessary to call this
method explicitly. It will be implicitly called by sendmail() when necessary.
SMTP.ehlo_or_helo_if_needed()
This method calls ehlo() and/or helo() if there has been no previous EHLO or HELO command
this session. It tries ESMTP EHLO first.
SMTPHeloError
The server didn’t reply properly to the HELO greeting.
SMTP.has_extn(name)
Return True if name is in the set of SMTP service extensions returned by the
server, False otherwise. Case is ignored.
SMTP.verify(address)
Check the validity of an address on this server using SMTP VRFY. Returns a tuple consisting of
code 250 and a full RFC 822 address (including human name) if the user address is valid.
Otherwise returns an SMTP error code of 400 or greater and an error string.
Many sites disable SMTP VRFY in order to foil spammers.
SMTP.login(user, password, *, initial_response_ok=True)
Log in on an SMTP server that requires authentication. The arguments are the username and the
password to authenticate with. If there has been no previous EHLO or HELO command this
session, this method tries ESMTP EHLO first. This method will return normally if the
authentication was successful, or may raise the following exceptions:
SMTPHeloError
The server didn’t reply properly to the HELO greeting.
SMTPAuthenticationError
The server didn’t accept the username/password combination.
SMTPNotSupportedError
The AUTH command is not supported by the server.
SMTPException
No suitable authentication method was found.
Each of the authentication methods supported by smtplib are tried in turn if they are advertised as
supported by the server. See auth() for a list of supported authentication
methods. initial_response_ok is passed through to auth().
Optional keyword argument initial_response_ok specifies whether, for authentication methods that
support it, an “initial response” as specified in RFC 4954 can be sent along with
the AUTH command, rather than requiring a challenge/response.
Changed in version 3.5: SMTPNotSupportedError may be raised, and
the initial_response_ok parameter was added.
SMTP.auth(mechanism, authobject, *, initial_response_ok=True)
Issue an SMTP AUTH command for the specified authentication mechanism, and handle the
challenge response via authobject.
mechanism specifies which authentication mechanism is to be used as argument to
the AUTH command; the valid values are those listed in the auth element of esmtp_features.
authobject must be a callable object taking an optional single argument:
data = authobject(challenge=None)
If optional keyword argument initial_response_ok is true, authobject() will be called first with no
argument. It can return the RFC 4954 “initial response” ASCII str which will be encoded and sent
with the AUTHcommand as below. If the authobject() does not support an initial response (e.g.
because it requires a challenge), it should return None when called with challenge=None.
If initial_response_ok is false, then authobject() will not be called first with None.
If the initial response check returns None, or if initial_response_ok is false, authobject() will be
called to process the server’s challenge response; the challenge argument it is passed will be
a bytes. It should return ASCII str data that will be base64 encoded and sent to the server.
The SMTP class provides authobjects for the CRAM-MD5, PLAIN, and LOGIN mechanisms;
they are named SMTP.auth_cram_md5, SMTP.auth_plain, and SMTP.auth_login respectively.
They all require that the userand password properties of the SMTP instance are set to appropriate
values.
User code does not normally need to call auth directly, but can instead call the login() method,
which will try each of the above mechanisms in turn, in the order listed. auth is exposed to
facilitate the implementation of authentication methods not (or not yet) supported directly
by smtplib.
New in version 3.5.
SMTP.starttls(keyfile=None, certfile=None, context=None)
Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP commands that
follow will be encrypted. You should then call ehlo() again.
If keyfile and certfile are provided, they are used to create an ssl.SSLContext.
Optional context parameter is an ssl.SSLContext object; This is an alternative to using a keyfile and
a certfile and if specified both keyfile and certfile should be None.
If there has been no previous EHLO or HELO command this session, this method tries
ESMTP EHLO first.
Deprecated since version 3.6: keyfile and certfile are deprecated in favor of context. Please
use ssl.SSLContext.load_cert_chain() instead, or let ssl.create_default_context() select the system’s
trusted CA certificates for you.
SMTPHeloError
The server didn’t reply properly to the HELO greeting.
SMTPNotSupportedError
The server does not support the STARTTLS extension.
RuntimeError
SSL/TLS support is not available to your Python interpreter.
Changed in version 3.3: context was added.
Changed in version 3.4: The method now supports hostname check
with SSLContext.check_hostname and Server Name Indicator (see HAS_SNI).
Changed in version 3.5: The error raised for lack of STARTTLS support is now
the SMTPNotSupportedErrorsubclass instead of the base SMTPException.
SMTP.sendmail(from_addr, to_addrs, msg, mail_options=(), rcpt_options=())
Send mail. The required arguments are an RFC 822 from-address string, a list of RFC 822 to-
address strings (a bare string will be treated as a list with 1 address), and a message string. The
caller may pass a list of ESMTP options (such as 8bitmime) to be used
in MAIL FROM commands as mail_options. ESMTP options (such as DSN commands) that
should be used with all RCPT commands can be passed as rcpt_options. (If you need to use
different ESMTP options to different recipients you have to use the low-level methods such
as mail(), rcpt() and data() to send the message.)
The from_addr and to_addrs parameters are used to construct the message envelope used by the
transport agents. sendmail does not modify the message headers in any way.
msg may be a string containing characters in the ASCII range, or a byte string. A string is
encoded to bytes using the ascii codec, and lone r and n characters are converted
to rn characters. A byte string is not modified.
If there has been no previous EHLO or HELO command this session, this method tries
ESMTP EHLO first. If the server does ESMTP, message size and each of the specified options
will be passed to it (if the option is in the feature set the server advertises).
If EHLO fails, HELO will be tried and ESMTP options suppressed.
This method will return normally if the mail is accepted for at least one recipient. Otherwise it
will raise an exception. That is, if this method does not raise an exception, then someone should
get your mail. If this method does not raise an exception, it returns a dictionary, with one entry
for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the
accompanying error message sent by the server.
If SMTPUTF8 is included in mail_options, and the server supports it, from_addr and to_addrs may
contain non-ASCII characters.
This method may raise the following exceptions:
SMTPRecipientsRefused
All recipients were refused. Nobody got the mail. The recipients attribute of the exception
object is a dictionary with information about the refused recipients (like the one returned
when at least one recipient was accepted).
SMTPHeloError
The server didn’t reply properly to the HELO greeting.
SMTPSenderRefused
The server didn’t accept the from_addr.
SMTPDataError
The server replied with an unexpected error code (other than a refusal of a recipient).
SMTPNotSupportedError
SMTPUTF8 was given in the mail_options but is not supported by the server.
Unless otherwise noted, the connection will be open even after an exception is raised.
Changed in version 3.2: msg may be a byte string.
Changed in version 3.5: SMTPUTF8 support added, and SMTPNotSupportedError may be raised
if SMTPUTF8is specified but the server does not support it.
SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=(), rcpt_options=())
This is a convenience method for calling sendmail() with the message represented by
an email.message.Message object. The arguments have the same meaning as for sendmail(), except
that msg is a Message object.
If from_addr is None or to_addrs is None, send_message fills those arguments with addresses
extracted from the headers of msg as specified in RFC 5322: from_addr is set to the Sender field if
it is present, and otherwise to the From field. to_addrs combines the values (if any) of the To, Cc,
and Bcc fields from msg. If exactly one set of Resent-* headers appear in the message, the regular
headers are ignored and the Resent-* headers are used instead. If the message contains more than
one set of Resent-* headers, a ValueError is raised, since there is no way to unambiguously detect
the most recent set of Resent-headers.
send_message serializes msg using BytesGenerator with rn as the linesep, and calls sendmail() to
transmit the resulting message. Regardless of the values
of from_addr and to_addrs, send_message does not transmit any Bcc or Resent-Bcc headers that
may appear in msg. If any of the addresses in from_addrand to_addrs contain non-ASCII
characters and the server does not advertise SMTPUTF8 support, an SMTPNotSupported error is
raised. Otherwise the Message is serialized with a clone of its policy with theutf8 attribute set
to True, and SMTPUTF8 and BODY=8BITMIME are added to mail_options.
MIME
Ordinarily, you get a message object structure by passing a file or some text to a parser, which
parses the text and returns the root message object. However you can also build a complete
message structure from scratch, or even individual Message objects by hand. In fact, you can also
take an existing structure and add new Message objects, move them around, etc. This makes a
very convenient interface for slicing-and-dicing MIME messages.
You can create a new object structure by creating Message instances, adding attachments and all
the appropriate headers manually. For MIME messages though, the email package provides some
convenient subclasses to make things easier.
Here are the classes:
class email.mime.base.MIMEBase(_maintype, _subtype, **_params)
Module: email.mime.base
This is the base class for all the MIME-specific subclasses of Message. Ordinarily you won’t
create instances specifically of MIMEBase, although you could. MIMEBase is provided primarily
as a convenient base class for more specific MIME-aware subclasses.
_maintype is the Content-Type major type (e.g. text or image), and _subtype is the Content-
Type minor type (e.g. plain or gif). _params is a parameter key/value dictionary and is passed
directly to Message.add_header.
The MIMEBase class always adds a Content-Type header (based on _maintype, _subtype,
and _params), and a MIME-Version header (always set to 1.0).
class email.mime.nonmultipart.MIMENonMultipart
Module: email.mime.nonmultipart
A subclass of MIMEBase, this is an intermediate base class for MIME messages that are
not multipart. The primary purpose of this class is to prevent the use of the attach() method,
which only makes sense for multipart messages. If attach() is called,
a MultipartConversionError exception is raised.
New in version 2.2.2.
class email.mime.multipart.MIMEMultipart([_subtype[, boundary[, _subparts[, _params]]]])
Module: email.mime.multipart
A subclass of MIMEBase, this is an intermediate base class for MIME messages that are multipart.
Optional _subtype defaults to mixed, but can be used to specify the subtype of the message.
A Content-Type header of multipart/_subtype will be added to the message object. A MIME-
Versionheader will also be added.
Optional boundary is the multipart boundary string. When None (the default), the boundary is
calculated when needed (for example, when the message is serialized).
_subparts is a sequence of initial subparts for the payload. It must be possible to convert this
sequence to a list. You can always attach new subparts to the message by using
the Message.attach method.
Additional parameters for the Content-Type header are taken from the keyword arguments, or
passed into the _params argument, which is a keyword dictionary.
4. METHEDOLOGY
 System requirements:
Operating system : Windows10
Python Version used(ide) : 3.7(64 bit)
 Enable less secure app using- http://myaccount.google.com/lesssecureapps
 We require three things for this Program:
1.SMTP domain name of service provider with port number.
2. Sender's username and password.
3. Receiver's e-mail address.
 Different E-mail service provider's have different smtp domain names:
1. Gmail-smtp.gmail.com,567
2. Yahoo-smtp.mail.yahoo.com,567
3. Outlook /Hotmail - smtp-mail.outlook .com,567
5.CODING & RESULT
TEXT SENDING CODING:Source code(Mail sending by sender)
Confirmation page:
Received mail to receiver:
IMAGE SENDING CODING
Image sending by sender
Confirmation page
Mail(Image) received

Weitere ähnliche Inhalte

Was ist angesagt?

DFD For E-learning Project
DFD For E-learning ProjectDFD For E-learning Project
DFD For E-learning ProjectShobhit Saxena
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologiesjerry vasoya
 
Char word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECTChar word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECTMahmutKAMALAK
 
Seminar report On Python
Seminar report On PythonSeminar report On Python
Seminar report On PythonShivam Gupta
 
Android Project Presentation
Android Project PresentationAndroid Project Presentation
Android Project PresentationLaxmi Kant Yadav
 
Network programming Using Python
Network programming Using PythonNetwork programming Using Python
Network programming Using PythonKarim Sonbol
 
Voice based email for blinds
Voice based email for blindsVoice based email for blinds
Voice based email for blindsArjun AJ
 
Project report of OCR Recognition
Project report of OCR RecognitionProject report of OCR Recognition
Project report of OCR RecognitionBharat Kalia
 
Mini Project on Data Encryption & Decryption in JAVA
Mini Project on Data Encryption & Decryption in JAVAMini Project on Data Encryption & Decryption in JAVA
Mini Project on Data Encryption & Decryption in JAVAchovatiyabhautik
 
Kerberos case study
Kerberos case studyKerberos case study
Kerberos case studyMayuri Patil
 
Machine Learning With Python | Machine Learning Algorithms | Machine Learning...
Machine Learning With Python | Machine Learning Algorithms | Machine Learning...Machine Learning With Python | Machine Learning Algorithms | Machine Learning...
Machine Learning With Python | Machine Learning Algorithms | Machine Learning...Simplilearn
 
Online Examination System Project report
Online Examination System Project report Online Examination System Project report
Online Examination System Project report SARASWATENDRA SINGH
 
Intro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationIntro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationAnkit Gupta
 
CSE Final Year Project Presentation on Android Application
CSE Final Year Project Presentation on Android ApplicationCSE Final Year Project Presentation on Android Application
CSE Final Year Project Presentation on Android ApplicationAhammad Karim
 

Was ist angesagt? (20)

DFD For E-learning Project
DFD For E-learning ProjectDFD For E-learning Project
DFD For E-learning Project
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Char word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECTChar word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECT
 
Captcha
CaptchaCaptcha
Captcha
 
Seminar report On Python
Seminar report On PythonSeminar report On Python
Seminar report On Python
 
Android Project Presentation
Android Project PresentationAndroid Project Presentation
Android Project Presentation
 
Network programming Using Python
Network programming Using PythonNetwork programming Using Python
Network programming Using Python
 
IP Security
IP SecurityIP Security
IP Security
 
Voice based email for blinds
Voice based email for blindsVoice based email for blinds
Voice based email for blinds
 
Project report of OCR Recognition
Project report of OCR RecognitionProject report of OCR Recognition
Project report of OCR Recognition
 
Mini Project on Data Encryption & Decryption in JAVA
Mini Project on Data Encryption & Decryption in JAVAMini Project on Data Encryption & Decryption in JAVA
Mini Project on Data Encryption & Decryption in JAVA
 
Chat application
Chat applicationChat application
Chat application
 
Online Exam System
Online Exam SystemOnline Exam System
Online Exam System
 
Final Report(SuddhasatwaSatpathy)
Final Report(SuddhasatwaSatpathy)Final Report(SuddhasatwaSatpathy)
Final Report(SuddhasatwaSatpathy)
 
Tic tac toe game code
Tic tac toe game codeTic tac toe game code
Tic tac toe game code
 
Kerberos case study
Kerberos case studyKerberos case study
Kerberos case study
 
Machine Learning With Python | Machine Learning Algorithms | Machine Learning...
Machine Learning With Python | Machine Learning Algorithms | Machine Learning...Machine Learning With Python | Machine Learning Algorithms | Machine Learning...
Machine Learning With Python | Machine Learning Algorithms | Machine Learning...
 
Online Examination System Project report
Online Examination System Project report Online Examination System Project report
Online Examination System Project report
 
Intro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationIntro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning Presentation
 
CSE Final Year Project Presentation on Android Application
CSE Final Year Project Presentation on Android ApplicationCSE Final Year Project Presentation on Android Application
CSE Final Year Project Presentation on Android Application
 

Ähnlich wie vishal_sharma: python email sending software

Ähnlich wie vishal_sharma: python email sending software (20)

Electronic mail
Electronic mailElectronic mail
Electronic mail
 
CS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKSCS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKS
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
 
E mail protocol - SMTP
E mail protocol - SMTPE mail protocol - SMTP
E mail protocol - SMTP
 
Intranet Messaging Project Report -phpapp02
Intranet Messaging Project Report -phpapp02Intranet Messaging Project Report -phpapp02
Intranet Messaging Project Report -phpapp02
 
Technical Background Overview Ppt
Technical Background Overview PptTechnical Background Overview Ppt
Technical Background Overview Ppt
 
Internet technology unit 6
Internet technology unit 6Internet technology unit 6
Internet technology unit 6
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
Spam Filter
Spam FilterSpam Filter
Spam Filter
 
Mca5010 web technologies
Mca5010   web technologiesMca5010   web technologies
Mca5010 web technologies
 
presentation on email.pptx
presentation on email.pptxpresentation on email.pptx
presentation on email.pptx
 
Chapter 4 communication2
Chapter 4 communication2Chapter 4 communication2
Chapter 4 communication2
 
ScavengerEXA
ScavengerEXAScavengerEXA
ScavengerEXA
 
SMTP and TCP protocol
SMTP and TCP protocolSMTP and TCP protocol
SMTP and TCP protocol
 
NP-lab-manual.docx
NP-lab-manual.docxNP-lab-manual.docx
NP-lab-manual.docx
 
Cn u5
Cn u5Cn u5
Cn u5
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
 
NP-lab-manual (1).pdf
NP-lab-manual (1).pdfNP-lab-manual (1).pdf
NP-lab-manual (1).pdf
 
NP-lab-manual.pdf
NP-lab-manual.pdfNP-lab-manual.pdf
NP-lab-manual.pdf
 
SMTP(true)
SMTP(true)SMTP(true)
SMTP(true)
 

Kürzlich hochgeladen

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

vishal_sharma: python email sending software

  • 1. ````` INDO GLOBAL COLLEGE OF ENGIMEERING ABHIPUR (MOHALI) E-MAIL SENDING SOFTWARE Submitted in partial fulfillment of the Requirements for the award of Degree of Bachelor of Technology in Computer Science Engineering SUBMITTED TO : Er. Parveen Saini Submitted By :- Name :Vishal Sharma Roll No. 15220 University Roll No. 1510185 Department of Computer Science & Engineering PUNJAB TECHNICAL UNIVERSITY JALANDHER(PUNJAB)
  • 2. DECLARATION I hereby declare that the project entitled “E-MAIL SENDING SOFTWARE” submitted for the B.Tech( Computer Science Engineering) degree is the original work and the project has not formed for the basic for the award of any other degree, diploma, fellowship other any other similar titles. Signature of the Student :- Place: Date:
  • 3. CERTIFICATE This is to certify that the project titled "E-MAIL SENDING SOFTWARE” is the bona fide work carried out by VISHAL SHARMA student of B.TECH(CSE) of Indo Global College of Engineering, Abhipur (Mohali) affiliated to Punjab Technical University, Jalandhar, Punjab(India) during the academic year 2017-18, in partial fulfillment of the requirements for the award of the degree of Bachelor of Technology(Computer Science Engineering) and that the project has not formed the basis for the award previously of any other degree, any other similar title. Signature of Guide :- Place: Date:
  • 4. CONTENTS  INTRODUCTION ………………………………………………………………… .  OBJECTIVE…………………………………………………………………………  TECHNOLOGY USED………………………………………………………………  METHEDOLOGY……………………………………………………………………  CODING & RESULT…………………………………………………………………
  • 5. 1 INTRODUCTION : Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Invented by Ray Tomlinson, email first entered limited use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. Some early email systems required the author and the recipient to both be online at the same time, in common with instant messaging. Today's email systems are based on a store-and-forward model. Email serversaccept, forward, deliver, and store messages. Neither the users nor their computers are required to be online simultaneously; they need to connect only briefly, typically to a mail server or a webmail interface, for as long as it takes to send or receive messages. Computer based mail and messaging became possible with the advent of time-sharing computers in the early 1960s, and informal methods of using shared files to pass messages were soon expanded into the first mail systems. Most developers of early mainframes and minicomputers developed similar, but generally incompatible, mail applications. Over time, a complex web of gateways and routing systems linked many of them. Many US universities were part of the ARPANET (created in the late 1960s), which aimed at software portability between its systems. That portability helped make the Simple Mail Transfer Protocol (SMTP) increasingly influential. SMTP defines the trace information of a message, which is also saved in the header using the following two fields:
  • 6. • Received: when an SMTP server accepts a message it inserts this trace record at the top of the header (last to first). • Return-Path: when the delivery SMTP server makes the final delivery of a message, it inserts this field at the top of the header. 2.OBJECTIVE A e-mail sending programme where host send the mail to receiver using SMTP ,a Python module. 3.TECHNOLOGY USED Python (programming language) Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales. Python features a dynamic type system and automatic memory management. It supports multiple programming paradigms, including object-oriented, imperative, functional and procedural, and has a large and comprehensive standard library. Python interpreters are available for many operating systems. CPython, the reference implementation of Python, is open sourcesoftware and has a community-based development model, as do nearly all of Python's other implementations. Python and CPython are managed by the non-profit Python Software Foundation. Python 2.0 was released on 16 October 2000 with many major new features, including a cycle- detecting garbage collector and support for Unicode. Python 3.0 was released on 3 December 2008. It was a major revision of the language that is not completely backward-compatible. Many of its major features were backported to Python 2.6.x[38] and 2.7.x version series. Releases of Python 3 include the 2to3 utility, which automates (at least partially) the translation of Python 2 code to Python 3. Python 2.7's end-of-life date was initially set at 2015 then postponed to 2020 out of concern that a large body of existing code could not easily be forward-ported to Python 3. In January 2017, Google announced work on a Python 2.7 to Go transcompiler to improve performance under concurrent workloads.
  • 7. MODULE UESD: SMTP The Simple Mail Transfer Protocol (SMTP) handles sending and routing email between mail servers. The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP listener daemon. An SMTP instance encapsulates an SMTP connection. It has methods that support a full repertoire of SMTP operation. If the optional host and port parameters are given, the SMTP connect() method is called with those parameters during initialization. For normal use, you should only require the initialization/connect, sendmail(), and quit() methods. An SMTP_SSL instance behaves exactly the same as instances of SMTP. SMTP_SSL should be used for situations where SSL is required from the beginning of the connection and using starttls() is not appropriate. If host is not specified, the local host is used. If port is zero, the standard SMTP- over-SSL port (465) is used. The optional arguments local_hostname, timeout and source_address have the same meaning as they do in the SMTP class. context, also optional, can contain a SSLContext and allows configuring various aspects of the secure connection. SMTP Objects An SMTP instance has the following methods:
  • 8. SMTP.set_debuglevel(level) Set the debug output level. A value of 1 or True for level results in debug messages for connection and for all messages sent to and received from the server. A value of 2 for level results in these messages being timestamped. Changed in version 3.5: Added debuglevel 2. SMTP.docmd(cmd, args='') Send a command cmd to the server. The optional argument args is simply concatenated to the command, separated by a space. This returns a 2-tuple composed of a numeric response code and the actual response line (multiline responses are joined into one long line.) In normal operation it should not be necessary to call this method explicitly. It is used to implement other methods and may be useful for testing private extensions. If the connection to the server is lost while waiting for the reply, SMTPServerDisconnected will be raised. SMTP.connect(host='localhost', port=0) Connect to a host on a given port. The defaults are to connect to the local host at the standard SMTP port (25). If the hostname ends with a colon (':') followed by a number, that suffix will be stripped off and the number interpreted as the port number to use. This method is automatically invoked by the constructor if a host is specified during instantiation. Returns a 2-tuple of the response code and message sent by the server in its connection response. SMTP.helo(name='') Identify yourself to the SMTP server using HELO. The hostname argument defaults to the fully qualified domain name of the local host. The message returned by the server is stored as the helo_resp attribute of the object. In normal operation it should not be necessary to call this method explicitly. It will be implicitly called by the sendmail() when necessary. SMTP.ehlo(name='')
  • 9. Identify yourself to an ESMTP server using EHLO. The hostname argument defaults to the fully qualified domain name of the local host. Examine the response for ESMTP option and store them for use by has_extn(). Also sets several informational attributes: the message returned by the server is stored as the ehlo_resp attribute, does_esmtp is set to true or false depending on whether the server supports ESMTP, and esmtp_features will be a dictionary containing the names of the SMTP service extensions this server supports, and their parameters (if any). Unless you wish to use has_extn() before sending mail, it should not be necessary to call this method explicitly. It will be implicitly called by sendmail() when necessary. SMTP.ehlo_or_helo_if_needed() This method calls ehlo() and/or helo() if there has been no previous EHLO or HELO command this session. It tries ESMTP EHLO first. SMTPHeloError The server didn’t reply properly to the HELO greeting. SMTP.has_extn(name) Return True if name is in the set of SMTP service extensions returned by the server, False otherwise. Case is ignored. SMTP.verify(address) Check the validity of an address on this server using SMTP VRFY. Returns a tuple consisting of code 250 and a full RFC 822 address (including human name) if the user address is valid. Otherwise returns an SMTP error code of 400 or greater and an error string. Many sites disable SMTP VRFY in order to foil spammers. SMTP.login(user, password, *, initial_response_ok=True) Log in on an SMTP server that requires authentication. The arguments are the username and the password to authenticate with. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method will return normally if the authentication was successful, or may raise the following exceptions: SMTPHeloError The server didn’t reply properly to the HELO greeting. SMTPAuthenticationError
  • 10. The server didn’t accept the username/password combination. SMTPNotSupportedError The AUTH command is not supported by the server. SMTPException No suitable authentication method was found. Each of the authentication methods supported by smtplib are tried in turn if they are advertised as supported by the server. See auth() for a list of supported authentication methods. initial_response_ok is passed through to auth(). Optional keyword argument initial_response_ok specifies whether, for authentication methods that support it, an “initial response” as specified in RFC 4954 can be sent along with the AUTH command, rather than requiring a challenge/response. Changed in version 3.5: SMTPNotSupportedError may be raised, and the initial_response_ok parameter was added. SMTP.auth(mechanism, authobject, *, initial_response_ok=True) Issue an SMTP AUTH command for the specified authentication mechanism, and handle the challenge response via authobject. mechanism specifies which authentication mechanism is to be used as argument to the AUTH command; the valid values are those listed in the auth element of esmtp_features. authobject must be a callable object taking an optional single argument: data = authobject(challenge=None) If optional keyword argument initial_response_ok is true, authobject() will be called first with no argument. It can return the RFC 4954 “initial response” ASCII str which will be encoded and sent with the AUTHcommand as below. If the authobject() does not support an initial response (e.g. because it requires a challenge), it should return None when called with challenge=None. If initial_response_ok is false, then authobject() will not be called first with None. If the initial response check returns None, or if initial_response_ok is false, authobject() will be called to process the server’s challenge response; the challenge argument it is passed will be a bytes. It should return ASCII str data that will be base64 encoded and sent to the server.
  • 11. The SMTP class provides authobjects for the CRAM-MD5, PLAIN, and LOGIN mechanisms; they are named SMTP.auth_cram_md5, SMTP.auth_plain, and SMTP.auth_login respectively. They all require that the userand password properties of the SMTP instance are set to appropriate values. User code does not normally need to call auth directly, but can instead call the login() method, which will try each of the above mechanisms in turn, in the order listed. auth is exposed to facilitate the implementation of authentication methods not (or not yet) supported directly by smtplib. New in version 3.5. SMTP.starttls(keyfile=None, certfile=None, context=None) Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP commands that follow will be encrypted. You should then call ehlo() again. If keyfile and certfile are provided, they are used to create an ssl.SSLContext. Optional context parameter is an ssl.SSLContext object; This is an alternative to using a keyfile and a certfile and if specified both keyfile and certfile should be None. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. Deprecated since version 3.6: keyfile and certfile are deprecated in favor of context. Please use ssl.SSLContext.load_cert_chain() instead, or let ssl.create_default_context() select the system’s trusted CA certificates for you. SMTPHeloError The server didn’t reply properly to the HELO greeting. SMTPNotSupportedError The server does not support the STARTTLS extension. RuntimeError SSL/TLS support is not available to your Python interpreter. Changed in version 3.3: context was added.
  • 12. Changed in version 3.4: The method now supports hostname check with SSLContext.check_hostname and Server Name Indicator (see HAS_SNI). Changed in version 3.5: The error raised for lack of STARTTLS support is now the SMTPNotSupportedErrorsubclass instead of the base SMTPException. SMTP.sendmail(from_addr, to_addrs, msg, mail_options=(), rcpt_options=()) Send mail. The required arguments are an RFC 822 from-address string, a list of RFC 822 to- address strings (a bare string will be treated as a list with 1 address), and a message string. The caller may pass a list of ESMTP options (such as 8bitmime) to be used in MAIL FROM commands as mail_options. ESMTP options (such as DSN commands) that should be used with all RCPT commands can be passed as rcpt_options. (If you need to use different ESMTP options to different recipients you have to use the low-level methods such as mail(), rcpt() and data() to send the message.) The from_addr and to_addrs parameters are used to construct the message envelope used by the transport agents. sendmail does not modify the message headers in any way. msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone r and n characters are converted to rn characters. A byte string is not modified. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server does ESMTP, message size and each of the specified options will be passed to it (if the option is in the feature set the server advertises). If EHLO fails, HELO will be tried and ESMTP options suppressed. This method will return normally if the mail is accepted for at least one recipient. Otherwise it will raise an exception. That is, if this method does not raise an exception, then someone should get your mail. If this method does not raise an exception, it returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. If SMTPUTF8 is included in mail_options, and the server supports it, from_addr and to_addrs may contain non-ASCII characters. This method may raise the following exceptions: SMTPRecipientsRefused
  • 13. All recipients were refused. Nobody got the mail. The recipients attribute of the exception object is a dictionary with information about the refused recipients (like the one returned when at least one recipient was accepted). SMTPHeloError The server didn’t reply properly to the HELO greeting. SMTPSenderRefused The server didn’t accept the from_addr. SMTPDataError The server replied with an unexpected error code (other than a refusal of a recipient). SMTPNotSupportedError SMTPUTF8 was given in the mail_options but is not supported by the server. Unless otherwise noted, the connection will be open even after an exception is raised. Changed in version 3.2: msg may be a byte string. Changed in version 3.5: SMTPUTF8 support added, and SMTPNotSupportedError may be raised if SMTPUTF8is specified but the server does not support it. SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=(), rcpt_options=()) This is a convenience method for calling sendmail() with the message represented by an email.message.Message object. The arguments have the same meaning as for sendmail(), except that msg is a Message object. If from_addr is None or to_addrs is None, send_message fills those arguments with addresses extracted from the headers of msg as specified in RFC 5322: from_addr is set to the Sender field if it is present, and otherwise to the From field. to_addrs combines the values (if any) of the To, Cc, and Bcc fields from msg. If exactly one set of Resent-* headers appear in the message, the regular headers are ignored and the Resent-* headers are used instead. If the message contains more than one set of Resent-* headers, a ValueError is raised, since there is no way to unambiguously detect the most recent set of Resent-headers. send_message serializes msg using BytesGenerator with rn as the linesep, and calls sendmail() to transmit the resulting message. Regardless of the values of from_addr and to_addrs, send_message does not transmit any Bcc or Resent-Bcc headers that may appear in msg. If any of the addresses in from_addrand to_addrs contain non-ASCII
  • 14. characters and the server does not advertise SMTPUTF8 support, an SMTPNotSupported error is raised. Otherwise the Message is serialized with a clone of its policy with theutf8 attribute set to True, and SMTPUTF8 and BODY=8BITMIME are added to mail_options. MIME Ordinarily, you get a message object structure by passing a file or some text to a parser, which parses the text and returns the root message object. However you can also build a complete message structure from scratch, or even individual Message objects by hand. In fact, you can also take an existing structure and add new Message objects, move them around, etc. This makes a very convenient interface for slicing-and-dicing MIME messages. You can create a new object structure by creating Message instances, adding attachments and all the appropriate headers manually. For MIME messages though, the email package provides some convenient subclasses to make things easier. Here are the classes: class email.mime.base.MIMEBase(_maintype, _subtype, **_params) Module: email.mime.base This is the base class for all the MIME-specific subclasses of Message. Ordinarily you won’t create instances specifically of MIMEBase, although you could. MIMEBase is provided primarily as a convenient base class for more specific MIME-aware subclasses. _maintype is the Content-Type major type (e.g. text or image), and _subtype is the Content- Type minor type (e.g. plain or gif). _params is a parameter key/value dictionary and is passed directly to Message.add_header. The MIMEBase class always adds a Content-Type header (based on _maintype, _subtype, and _params), and a MIME-Version header (always set to 1.0). class email.mime.nonmultipart.MIMENonMultipart Module: email.mime.nonmultipart A subclass of MIMEBase, this is an intermediate base class for MIME messages that are not multipart. The primary purpose of this class is to prevent the use of the attach() method, which only makes sense for multipart messages. If attach() is called, a MultipartConversionError exception is raised. New in version 2.2.2.
  • 15. class email.mime.multipart.MIMEMultipart([_subtype[, boundary[, _subparts[, _params]]]]) Module: email.mime.multipart A subclass of MIMEBase, this is an intermediate base class for MIME messages that are multipart. Optional _subtype defaults to mixed, but can be used to specify the subtype of the message. A Content-Type header of multipart/_subtype will be added to the message object. A MIME- Versionheader will also be added. Optional boundary is the multipart boundary string. When None (the default), the boundary is calculated when needed (for example, when the message is serialized). _subparts is a sequence of initial subparts for the payload. It must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the Message.attach method. Additional parameters for the Content-Type header are taken from the keyword arguments, or passed into the _params argument, which is a keyword dictionary. 4. METHEDOLOGY  System requirements: Operating system : Windows10 Python Version used(ide) : 3.7(64 bit)  Enable less secure app using- http://myaccount.google.com/lesssecureapps
  • 16.  We require three things for this Program: 1.SMTP domain name of service provider with port number. 2. Sender's username and password. 3. Receiver's e-mail address.  Different E-mail service provider's have different smtp domain names: 1. Gmail-smtp.gmail.com,567 2. Yahoo-smtp.mail.yahoo.com,567 3. Outlook /Hotmail - smtp-mail.outlook .com,567 5.CODING & RESULT TEXT SENDING CODING:Source code(Mail sending by sender)
  • 18. IMAGE SENDING CODING Image sending by sender Confirmation page