Metadata-Version: 2.1
Name: sftp-smtp-imap
Version: 1.0.4
Summary: This package includes functionality to work with any SFTP, IMAP and SMTP server
Home-page: https://github.com/SUNESHPANDITA/sftp-smtp-imap-package.git
Author: Sunesh Pandita
Author-email: suneshpandita2009@gmail.com
License: Copyright 2024 @Sunesh Pandita
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
        and associated documentation files (the “Software”), to deal in the Software without restriction, 
        including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
        and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 
        subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial 
        portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
        INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
        PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
        FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
        ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Platform: Windows
Requires-Python: >=3.9.0
Description-Content-Type: text/markdown
License-File: LICENSE.txt

### Package name is SFTP-SMTP-IMAP.

    This package will simplify to work with SFTP, IMAP and SMTP server with the commonly used functionalities.
    This package includes 3 classes (sftp, smtp and imap) to work with.

#### Dependency
     pip install mail-parser==3.15.0
     pip install pysftp==0.2.9

### Class sftp:-
        This class includes all the functions required to work with SFTP server.

        setup_credentials(self, sftp_host, sftp_port, sftp_username, sftp_password, sftp_remote_locatio)
            As a first step, user need to pass SFTP credentials for setting details in variables.

        list_files_directories(self, remote_location, extension, prefix, postfix, within)
            This will give list of files and directories based on criteria passed in
            extension, prefix, postfix and within parameters.

        create_remote_folder(self, remote_location, foldername)
            This function can be used to create a folder on SFTP server.

        delete_remote_folder(self, remote_location, foldername)
            This function can be used to delete a folder on SFTP server.

        rename_remote_folder(self, remote_location, old_foldername, new_foldername)
            This function can be used to rename a folder on SFTP server.

        upload_local_files(self, local_folder, remote_folder, list_of_filenames)
            This function can be used to upload single or list of files on SFTP server.

        download_remote_files(self, remote_folder, local_folder, list_of_filenames)
            This function can be used to download single or list of files from SFTP server to local server/machine.

        rename_remote_file(self, remote_location, old_filename, new_filename)
            This function can be used to rename a file on SFTP server.

        delete_remote_files(self, remote_location, list_of_filenames)
            This function can be used to delete a single or list of files on SFTP server.



### Class smtp:-
        This class includes all the functions required to work with SMTP server.

        setup_credentials(self, smtp_host, smtp_port, smtp_username, smtp_password)
            As a first step, user need to pass SMTP credentials for setting details in variables.

        sendmail_without_attachment(self, TO, CC, BCC, SUBJECT, BODY, FROM_EMAIL)
            Use this function when you want to send email without any attachment.

        sendmail_with_attachment(self, TO, CC, BCC, SUBJECT, BODY, ATTACHMENTS, FROM_EMAIL)
            Use this function when you want to send email with single or multiple attachments.



### Class imap:-
        This class includes all the functions required to work with IMAP server.

        setup_credentials(self, imap_host, imap_port, imap_username, imap_password)
            As a first step, user need to pass IMAP credentials for setting details in variables.

        email_verification(EmailSubject, FromEmail, Messageid, filter_for, prefix, postfix, within)
            Use this function when you want to know the what mail to process from given mail folder.

        download_attachments_only(self, mail_foldername, attachment_folder_location, filter_for="", prefix="", postfix="", within="")
            Use this function when you want to download email attachments only.

        purge_email(self, mail_foldername, list_of_messageid)
            Use this function when you want to delete an email from mail folder.
            Example of mail_foldername can be Inbox, Processed, Sent etc.

        move_emails(self, source_mail_foldername, destination_mail_foldername, list_of_messageid)
            Use this function when you want to delete an email from mail folder.
            Example of source_mail_foldername/destination_mail_foldername can be Inbox, Processed, Sent etc.

        save_email_data_in_xml(self, mail_foldername, xml_folder_location, filter_for="", prefix="", postfix="", within="")
            Use this function when you want to download email details in a XML file.

        save_email_data_in_xml_with_attachment_in_folder(self, mail_foldername, xml_folder_location, attachment_folder_location,filter_for="", prefix="", postfix="", within="")
            Use this function when you want to download email details in a XML file along with attachments.



## How to use this project: 

### For SFTP
   - from sftp.sftp import sftp

   - sftp.setup_credentials(sftp, "", , "", "")  # Mandatory to use

   - sftp.list_files_directories(sftp, "")
   - sftp.create_remote_folder(sftp, "", "")
   - sftp.delete_remote_files(sftp, "", [""])
   - sftp.rename_remote_folder(sftp, "", "", "")
   - sftp.download_remote_files(sftp, "", "", [""])
   - sftp.upload_local_files(sftp, "", "", [""])  # This function return result in form of "SUCCESS" or "FAILURE"   
                                                    for a single or list of files. This will be a collective result of processing.
   - sftp.rename_remote_file(sftp, "", "", "")
   - sftp.delete_remote_files(sftp, "", [""])

### For SMTP
   - from smtp.smtp import smtp

   - smtp.setup_credentials(smtp,"", , "", "")    #Mandatory to use

   - smtp.sendmail_without_attachment(smtp, "", "", "", "", "", "")
   - smtp.sendmail_with_attachment(smtp, "", "", "", "", "", [""], "")

### For IMAP
   - from imap.imap import imap

   - imap.setup_credentials(imap, "","" , "", "")   #Mandatory to use

   - imap.download_attachments_only(imap, "", "", filter_for="", prefix="", postfix="", within="")
   - imap.purge_email(imap, "", "")
   - imap.move_emails(imap, "", "", "")
   - imap.save_email_data_in_xml(imap, "", "", filter_for="", prefix="", postfix="", within="")
   - imap.save_email_data_in_xml_with_attachment_in_folder(imap, "", "", "", filter_for="", prefix="", postfix="", within="")



This package is developed by Sunesh Pandita.
GitHub repo:- [Link](https://github.com/SUNESHPANDITA/sftp-smtp-imap-package.git) 


