Skip to content

imrany/open-email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

open-email

A microservice that sents mail to clients. You can use this api to automate email sending in your application or project.

If you have clients or running an online business and you would like your clients to get email notifications when you bring out a new project in the market then this api is for you. You can easily connect you website or app with this api, follow the step below, and it's free

How to use this service

You can send an email using this api by sending a POST request to https://open-email-delivery.onrender.com/send with the following body:

  • mailfrom - the sent of the email, in this case it will be your email address.
  • mailto -the recipient or receiver, in this case it will be email address you are sent the notice to.
  • subject - subject of the email i.e topic/title associate with the email.
  • message - the message/text you would like to sent.

Examples:

Used as in HTML in a form submit

<form method="POST" action="https://open-email-delivery.onrender.com/send">
    <input type="email" name="mailfrom" value="[email protected]" required/>
    <input type="email" name="mailto" value="[email protected]" required/>
    <input type="text" name="subject" value="Any Subject" required/>
    <input type="text" name="message" value="Hey there" required/>
    <button>Send email</button>
</form>

Used as in vanilla javascript (fetch api)

async function send(){
    try{
        const url =`https://open-email-delivery.onrender.com/send`;
        const response=await fetch(url,{
            method:"POST",
            header:{
                "content-type":"application/json"
            },
            body:JSON.stringify({
                mailfrom:"[email protected]",
                mailto:"[email protected]",
                subject:"Any Subject",
                message:"How are you friend"
            })
        })
        const parseRes=await response.json();
        console.log(parseRes);
    }catch(err){
        console.log(err.message);
    }
}
//invoke the function above
send();

This javascript function will send a POST to the open-email then will return a json response.

{
    "msg":"Mail sent"
}

Otherwise you would receive an error

{
    "error":"Mail wasn't sent, try again!"
}

Used as in Python (Python Requests library)

import requests
r = requests.post('https://open-email-delivery.onrender.com/send', json={
  "mailfrom": "[email protected]",
  "mailto": "[email protected]",
  "subject": "Any Subject",
  "message":"Hello there"
})
print(f"Status Code: {r.status_code}, Response: {r.json()}")

Used as in Curl

curl -X POST https://open-email-delivery.onrender.com/send -H "Content-Type: application/json" -d '{"mailfrom": "[email protected]","mailto": "[email protected]", "subject": "Any Subject","message": "Hello there"}'  

Response should be

{"msg":"Mail sent"}

Otherwise you would receive an error

{"error":"Mail wasn't sent, try again!"}

You can test the api by placing your email address on both the mailfrom and the mailto fields and the response, after sending the request check your email inbox.

License

MIT License

About

Microservice that send mail to clients

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published