Mailing service that is fully customizable, with support for:
sending emails using SMTP and receiving emails using POP3,
mail storage,
multiple email accounts.
System service which sends emails using SMTP for system messages like password recovery and notifications.
Mailing service
REST API
POST {{host}}/api/core/mail/send/{account} - send a single email using the specified account.
GET/POST {{host}}/api/core/mail/pull/{account?} - pull emails; the account is optional.
Experimental GET/POST {{host}}/api/core/mail/push/{account?} - push emails; the account is optional.
Experimental GET/POST {{host}}/api/core/mail/sync/{account?} - pull and push emails; the account is optional.
Data objects
[app].[mail] - mail storage for incoming and outgoing emails.
[app].[mail].[mail_attachments] - XML field attachments.
[app].[mail].[mail_body_text] - text only.
[app].[mail].[mail_body_html] - safe HTML representation.
[app].[files] - file storage.
Notes:
Mails can be put directly into storage and sent using the push or sync API.
Mail accounts configuration
Mail account configuration is stored in
team settings: Settings+Teams+Team Secret .
The team type must be set to mail to be able to store mail account configuration.
To send or receive emails you need to be part of the mail team
{"mail_pop3_server":"pop.gmail.com","mail_pop3_port":995,"mail_smtp_server":"smtp.gmail.com","mail_smtp_port":587,"mail_starttls":true,"mail_username":"recent:[email protected]","mail_password":"xxxxx","mail_from":"[email protected]","mail_from_name":"Your company name"}
# Python mail test library# This library is used to test the mail APIimportpoplibimportgetpass# Get user credentialssystem={"mail_smtp_server":"smtp-relay.gmail.com","mail_smtp_port":"587","mail_username":"[email protected]","mail_password":"xxxxx","mail_from":"[email protected]"}# Connect to the mail servermail_box=poplib.POP3_SSL(mailserver,995)# Login to your accountmail_box.user(user)mail_box.pass_(password)# Get the number of mail messagesnum_messages=len(mail_box.list()[1])print('Total emails: {}'.format(num_messages))# iterate mails baackwards and make read foriinrange(num_messages,0,-1):response,headerLines,bytes=mail_box.retr(i)forheaderinheaderLines:ifheader.startswith(b"Date:"):print("Email {} Date: {}".format(i,header.decode()))print("Email {} Bytes: {}".format(i,bytes))# Iterate mails and print dates# for i in range(num_messages):# response, headerLines, bytes = mail_box.retr(i+1)# for header in headerLines:# if header.startswith(b"Date:"):# print("Email {} Date: {}".format(i+1, header.decode()))# Close the connectionmail_box.quit()
Troubleshooting Smtp
SMTP test in python
In case of any problems you test configuration using python script
importsmtplibfromemail.mime.multipartimportMIMEMultipartfromemail.mime.textimportMIMETextsystem={"mail_smtp_server":"smtp-relay.gmail.com","mail_smtp_port":"587","mail_username":"[email protected]","mail_password":"xxxxx","mail_from":"[email protected]"}msg:MIMEMultipart=MIMEMultipart()msg['To']="[email protected]"msg['Subject']="Test"# add in the message bodymsg.attach(MIMEText('Test message','plain'))# create serverserver=smtplib.SMTP(system["mail_smtp_server"])server.starttls()# Login Credentials for sending the mailserver.login(system['mail_username'],system["mail_password"])# send the message via the serverserver.sendmail(system['mail_from'],msg['To'],msg.as_string())server.quit()
Query to get email attachments for single email from mail storage