LATEST VERSION 1.2 (29.11.2014)
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.
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).
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 (POCO, libconv, libtidy).
See UMail in action
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).
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).
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,
var Global.mail= UMail.new("smtp.gmail.com",587,"pop.gmail.com",995,"example[at]gmail.com";,"12345","utf-8");
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>");
var number_of_new_emails = mail.receiveNew;