Skip to main content

Generate (or write) and send emails using an LLM

Project description

Email sender

This is a python lib to send mail. The mail can be generated by a llm with ollama or you can write it.

Prerequisites

You'll need:

  • linux (ubuntu works perfectly)
  • an email (gmail, it's only work on gmail for the moment)
  • application password (can be create in the gmail account)
  • python (works on 3.12.3)

Installation

chmod 755 ./init.sh
./init.sh

Run the program

./run.sh

Usage examples

Example 1: generating the mail

mail = Mail(prompt, model)

mail.set_context(prompt, subject)
mail.set_sender(sender, password)
mail.set_recipient(recipient)

mail.generate()

Example 2: manualy writing

mail = Mail(prompt, model)

mail.set_sender(sender, password)
mail.set_recipient(recipient)

mail.set_subject(subject)
mail.set_body(body)

Example 3: editing the subject or the body

The mail can be send, but after the preview, you want to edit the mail (body and/or subject)

mail = Mail(prompt, model)

# ... generated or wrote

mail.set_subject(subject)
mail.set_body(body)

The class

- The constructor

You'll need:

  • prompt: the prompt for the llm
  • model: the model of the llm
variable = Mail(prompt, model)

The sets methods

- Set recipient

You'll need:

  • recipient: the email to send the mail
variable.set_recipient(recipient)

- Set sender

You'll need:

  • sender: the email to send the mail
  • password: the application password
variable.set_sender(sender, password)

- Set context

You'll need:

  • context: approximatly the idea for the body
  • mail_subject: approximatly the idea for the subject
variable.set_context(context, mail_subject)

Generate ,preview and send methods

- Generate

You'll need:

  • use the set method to give to the variable the informations to generate the mail
variable.generate()

- Preview

You'll need:

  • use the genate method or use the set_subject and set_body methods if you don't want to generate
variable.preview()

- Send

You'll need:

  • use the genate method or use the set_subject and set_body methods if you don't want to generate
variable.send()

Other set methods

- Set body

You'll need:

  • body: the body of the mail
variable.set_body(body)

- Set subject

You'll need:

  • subject: the subject of the mail
variable.set_subject(subject)

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

lau_project_mail-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lau_project_mail-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file lau_project_mail-0.1.0.tar.gz.

File metadata

  • Download URL: lau_project_mail-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lau_project_mail-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7938a43a6c24bc7e2eceb750a56151502fdaa0848586ff25e253f92dc6badc55
MD5 a8d78abc22daf190a993e6f621235894
BLAKE2b-256 9207d57e93b7df95dd2148a5ae7250e32982ba5763514962e78aafb39605b9e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lau_project_mail-0.1.0.tar.gz:

Publisher: python-publish.yml on LAU-Project/Email-sender

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lau_project_mail-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lau_project_mail-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf59d07e79e8b8c07e908457bb41bd740d6add9474820e7683e92d9091fca59f
MD5 5ff1d63faad52a96863467727471980c
BLAKE2b-256 dce92b9b951d334983b4ffe6a8054d1097ec329d994913c9621f9cc2c722adc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for lau_project_mail-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on LAU-Project/Email-sender

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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