LATEST VERSION 1.2 (29.11.2014)

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 POCO library and utilizes Secure Sockets Layer (SSL) connection. UMail was tested with a Gmail account.

The POCO C++ Libraries are a collection of open source C++ class libraries that simplify and accelerate the development of network-centric, portable applications in C++. The libraries integrate perfectly with the C++ Standard Library and fill many of the functional gaps left open by it. Their modular and efficient design and implementation makes the POCO C++ Libraries extremely well suited for embedded development, an area where the C++ programming language is becoming increasingly popular, due to its suitability for both low-level (device I/O, interrupt handlers, etc.) and high-level object-oriented development.  

Requirements

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

  • libiconv.dll
  • PocoCrypto.dll
  • PocoFoundation.dll
  • PocoNet.dll
  • PocoNetSSL.dll
  • PocoUtil.dll
  • PocoXML.dll
  • libssl32.dll
  • ssleay32.dll

You can also use a static linking option. In this case you need to download POCO, OpenSSL, libconv libraries and add in preprocessor definitions (USING_STATIC_LIBICONV, POCO_STATIC). You can download all the precompiled projects here (POCOlibconvlibtidy).

See UMail in action

Module functions

Main functions

UMail.new("smtp_address", smtp_port, "pop3_address", pop3_port, "login", "password", "encoding"); - set up a mail client, you can set the encoding for your mails (content, subject, sender name, file names, etc.), default encoding is UTF-8.
bool = UMail.SaveAttachments(ID,"path/to/save/"); - save attachments of email with the specified ID, returns false if any problem occurs (check console information).

Sending functions

UMail.sendFrom("I Robot"); - set sender name,
UMail.sendTo(["address1","address2",...]);  - set recipent list,
UMail.sendCc(["address3","address4",...]);  - set carbon copy recipent list,
UMail.sendBcc(["address5","address6",...]); - set blind carbon copy recipent list,
UMail.sendSubject("text"); - set subject,
UMail.sendContent("text"); - set content (you can use html tags),
UMail.sendAttachment(["file1","file2",...]);  - add attachments (set path and name of attached file),
bool = UMail.Send(); - send message, returns false if any problem occurs (check console information).

Receiving functions

bool = Umail.Check(); - check for new email (this function will download only headers, server will be informing you about new emails), 
UMail.receiveNew; - the number of new emails waiting for download 
 
bool = UMail.Receive(); - download all emails, (if there are no new emails, all receive lists stay unchanged), returns false if any problem occurs (check console information),
senderID = UMail.receiveFrom[ID]; - get sender name of email with the specified ID,
["recipient1 recipient2,..."] = UMail.receiveTo[ID]; - get main recipient list of email with the specified ID,
["recipient1 recipient2,..."] = UMail.receiveCc[ID]; - get carbon copy recipient list of email with the specified ID,
subjectID = UMail.receiveSubject[ID]; - get subject of email with the specified ID,
dateID = UMail.receiveDate[ID]; - get date of email with the specified ID,
textID = UMail.receiveContent[ID]; - get content of email with the specified ID, if the content is multipart format it first,
["attachment1, attachment2,..."] =UMail.receiveAttachment[ID]; - get attachment list separated by ',' of email with the specified ID,
 

Urbiscript examples

Example 1

loadModule("UMail");
var Global.mail= UMail.new("smtp.gmail.com",587,"pop.gmail.com",995,"example[at]gmail.com";,"12345","utf-8");
 
mail.sendFrom("I Robot");
mail.sendTo(["example.name[at]gmail.com";,"another.example[at]gmail.com";]);
mail.sendCc([]);
mail.sendBcc([]);
mail.sendSubject("Hi! It's me");
mail.sendContent("I am a funny robot!<br> Please check my attachment.<br><br><b><i>I Robot</b></i>");
mail.sendAttachment(["me.jpg"]);
mail.Send();

Example 2

mail.Check();
var number_of_new_emails = mail.receiveNew;

Example 3

mail.Receive();
mail.receiveFrom[0];
mail.receiveTo[0];
mail.receiveCc[0];
mail.receiveSubject[0];
mail.receiveDate[0];
mail.receiveContent[0];
mail.receiveAttachment[0];
mail.SaveAttachments(0,"files/");

Download

LINK

 

 

 

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

FLASH Documentation