Metadata-Version: 2.4
Name: lau-project-mail
Version: 0.1.0
Summary: Generate (or write) and send emails using an LLM
Project-URL: Homepage, https://github.com/LAU-Project/Email-sender
Author: LAU Project
License: MIT
License-File: LICENSE
Requires-Python: >=3.9
Requires-Dist: ollama
Description-Content-Type: text/markdown

# 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

```bash
chmod 755 ./init.sh
./init.sh
```

# Run the program

```bash
./run.sh
```

# Usage examples

## Example 1: generating the mail
```python
mail = Mail(prompt, model)

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

mail.generate()
```

## Example 2: manualy writing
```python
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)
```python
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

```python
variable = Mail(prompt, model)
```

## The sets methods 

### - Set recipient
You'll need:
- recipient: the email to send the mail

```python
variable.set_recipient(recipient)
```

### - Set sender
You'll need:
- sender: the email to send the mail
- password: the application password

```python
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

```python
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

```python
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

```python
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

```python
variable.send()
```

## Other set methods

### - Set body
You'll need:
- body: the body of the mail

```python
variable.set_body(body)
```

### - Set subject
You'll need:
- subject: the subject of the mail

```python
variable.set_subject(subject)
```