Skip to main content

send simple text using kakao mail

Project description

Kakaomail

A Python library for sending emails using Kakao Mail.

Installation

You can install kakaomail using pip:

pip install kakaomail

Alternatively, you can install it from the source:

git clone https://github.com/aloecandy/kakaomail.git
cd kakaomail
python setup.py install

Configuration

For authentication, you can use a .env file to store your Kakao Mail credentials. Create a .env file in your project's root directory with the following content:

KAKAO_ID=your_kakao_id
KAKAO_PASSWORD=your_kakao_password

The library will automatically load these credentials.

Usage

Login

There are two ways to log in:

  1. Using .env file (recommended):

    If you have configured your credentials in a .env file, you can log in without passing any arguments:

    import kakaomail
    
    if kakaomail.login():
        print("Successfully logged in!")
    else:
        print("Failed to log in.")
    
  2. Passing credentials directly:

    You can also pass your ID and password directly to the login function:

    import kakaomail
    
    if kakaomail.login("your_kakao_id", "your_kakao_password"):
        print("Successfully logged in!")
    else:
        print("Failed to log in.")
    

Sending Emails

Once logged in, you can send emails using the send function.

Basic Text Email:

import kakaomail

if kakaomail.login():
    kakaomail.send(
        recipient='recipient@domain.com',
        subject='Hello from Kakaomail!',
        text='This is a test email.'
    )

HTML Email:

To send an HTML email, set the subtype parameter to 'html'.

import kakaomail

if kakaomail.login():
    html_content = "<h1>Hello</h1><p>This is an HTML email.</p>"
    kakaomail.send(
        recipient='recipient@domain.com',
        subject='HTML Email Test',
        text=html_content,
        subtype='html'
    )

Email with Attachments:

You can send attachments by providing a list of file paths to the attachments parameter.

import kakaomail

if kakaomail.login():
    kakaomail.send(
        recipient='recipient@domain.com',
        subject='Email with Attachments',
        text='Please find the attached files.',
        attachments=['/path/to/file1.jpg', '/path/to/file2.pdf']
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kakaomail-1.0.1.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file kakaomail-1.0.1.tar.gz.

File metadata

  • Download URL: kakaomail-1.0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for kakaomail-1.0.1.tar.gz
Algorithm Hash digest
SHA256 528094814b6c1aa1fd8facd0bc3e5b630efb3d2f57de4093bd7ae48edaf804c7
MD5 ac84aca025aa522e13990fd0f874439a
BLAKE2b-256 4961d144e7cf1cd86de1f8cef12b5c2662ac41c485d701a06ee6049f780aa08d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page