LATEST VERSION 1.5 (17.03.2015)

Description

UMail is an UObject created to send and receive emails. With this module you will be able to send and receive emails to many recipients, add and save attachments, etc. This module is based on cURL library and utilizes Secure Sockets Layer (SSL) connection. cURL is a computer software project providing a library for transferring data using various protocols.

The module allows you to send your own custom code HTML email. It automatically creates a plain-text version of your HTML code, and also works alongside internet service providers (ISPs) and anti-spam groups to ensure the best delivery possible. Multipart/Alternative MIME format sends both the HTML and plain-text versions of an email. When a recipient receives your email, their email client will automatically determine which format to display.

UMail is using UTF-8 encoding and was tested with a Gmail account.

Requirements

UMail was compiled with all the shared libraries (all included in umailcurl_1x.zip package - "DLL" folder). Copy them to the uobjects folder or set path in system environment variable (PATH).

  • libcurl.dll
  • libiconv.dll
  • libebay32.dll
  • ssleay32.dll

You can also download all the precompiled files here (cURL, OpenSSL, libconv).

See UMail in action

Module functions

Main functions

UMail.new("smtp_address:smtp_port", "imap_address:pop3_port", "login", "password"); - set up a mail client,
UMail.debug - if set to 1, displays execution information in the console.

Sending functions

UMail.sendFrom("I Robot"); - set sender name,
UMail.sendTo(["address1","address2",...]); - set a recipient list,
UMail.sendCc(["address3","address4",...]); - set a carbon copy recipient list,
UMail.sendBcc(["address5","address6",...]); - set a blind carbon copy recipient list,
UMail.sendSubject("text"); - set subject,
UMail.sendContent("text"); - set content (you can use html tags, even links to attachments),
UMail.sendAttachment(["file1","file2",...]); - add attachments (set a path and name of attached file),
UMail.sendAttachmentID(["file1_ID","file2_ID",...]); - set attachment IDs (see example 2),
bool = UMail.Send(); - perform a sending process, return false if any problem occurs inside the module (check console information).

Receiving functions

bool = Umail.Check(); - check new (unread) emails, returns false if any problem occurs (check console information),
bool = UMail.SaveAttachments("path/to/save/"); - save attachemnts of the received email, returns false if any problem occurs (check console information).
["ID1","ID2",...,"IDn"] = UMail.receiveID; - a number of new emails on the user's inbox folder,

bool = UMail.Receive("IDx"); - download email for given ID, return false if any problem occurs (check console information),
"sender name" = UMail.receiveFrom; - get sender name,
["recipient1","recipient2",...] = UMail.receiveTo; - get main recipient list,
["recipient1","recipient2",...] = UMail.receiveCc; - get carbon copy recipient list,
"subject" = UMail.receiveSubject; - get subject,
"Thu, 29 Jan 2015 20:45:24 +0100" = UMail.receiveDate; - get date of email,
"Content" = UMail.receiveContent; - get plain text content of email,
"Content" = UMail.receiveContentHTML; - get HTML content of email,
["attachment1", "attachment2",...] = UMail.receiveAttachment; - get attachment list.

Urbiscript examples

Example 1

loadModule("UMail");
var Global.mail= UMail.new("smtp://smtp.gmail.com:587","imaps://imap.gmail.com:993","login[at]gmail.com","password");
mail.sendFrom("My Robot");
mail.sendTo(["recipient1[at]example.com"]);
mail.sendCc(["recipient2[at]example.com"]);
mail.sendBcc(["recipient3[at]example.com"]);
mail.sendSubject("Mail from My Robot!");
mail.sendContent("Best regards from My Robot.<br> Check attachment.<br><br><b><i>My Robot</b></i>");
mail.sendAttachment(["photo.png"]);
mail.Send();
 
sleep(2s);
 
mail.Check();
mail.receiveID;
mail.Receive(mail.receiveID[0]);
 
echo(mail.receivedFrom);
echo(mail.receivedSubject);
echo(mail.receivedContent);
if (mail.receivedAttachment.size > 0) mail.SaveAttachments("path/");

Example 2

mail.sendContent("<img src="cid:ID_XXX_XXX"></img><br><br><b><i>My Robot</b></i>");
mail.sendAttachment(["saved/photo.jpg"]);
mail.sendAttachmentID(["ID_XXX_XXX"]);

Download

LINK

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 0.9.1, 15.05.2017

FLASH Documentation