GCALDaemon Project Home home | forums | contact | rss | stats | donate
::Usage
Home
Features
Screenshots
Downloads
User's Guide
For Developers
License
  Guides   Setup Gmail sender service

The GCALDaemon's Gmail sender is a mail transfer agent that polls a local folder for new messages. When a new message is found, the service sends your plain text or HTML files without your having to open your e-mail client. With this solution you can send Gmail messages directly and easily from your text editor or from your application.

  Configure sendmail

1) Install GCALDaemon (Java 1.5 required).

2) Enable Gmail's SMTP service.

A) Log in to your Gmail account.
B) Click Settings at the top of any Gmail page.
C) Click Forwarding and POP/IMAP.
D) Select Enable IMAP.
E) Click Save Changes.

If you've enabled the IMAP service, you can also use the SMTP service. If you don't have 'Enable IMAP' option and your default language is not US English, changing Gmail display language to US English in General settings is likely to IMAP enable your Gmail.

3) Start password encoder ('password-encoder.bat' or 'password-encoder.sh'). Input your Gmail password and press ENTER. Copy the encoded password.

4) Edit the 'gcal-daemon.cfg' file with your text editor.

A) Set the 'sendmail.enabled' property to 'true'
B) Set the 'sendmail.google.username' property to your Gmail address
C) Set the 'sendmail.google.password' property to your encoded password

Optionally, set the 'sendmail.dir.path' property to refer to the outgoing mail folder.

5) Setup finished - start GCALDaemon with 'standalone-start.bat' or 'standalone-start.sh'.

6) Open your text editor, and create a short test message. Save this test message into your outgoing mail directory (/outbox) named recipient@company.com (you must enter a valid email address).

7) GCALDaemon submits your mail within 10-15 seconds.

8) You can send HTML files in a similar manner, or a simple copy/paste/rename command.

  Sending structured text messages

You can add special email properties to your message. The valid properties are:

  • TO - Comma-separated list of primary recipients (optional, default: sender or filename)
  • CC - Comma-separated list of subsidiary recipients (carbon copy, optional)
  • BCC - Comma-separated list of BCC recipients (blind carbon copy, optional)
  • SUBJECT - Title of the email (optional, default: "Mail from <sender>")
  • ENCODING - Character encoding of the mail (optional, default: platform-specific)
  • All property are optional and case insensitive, the name of the text file doesn't matter (recipients determined by the file's content). Use "UTF-8" encoding for special characters, otherwise use "ISO-8859-1", "ISO-8859-2", "US-ASCII" or other standard encoding. You can use HTML formatter tags like <b>, <i>, <font...>, <color...>, <center>, <br/>, etc. GCALDaemon autodetects HTML tags in the message's body, and changes the mail's content type to "text/html". Note: do not include entire HTML pages, with <html>, <head> and <body> parts - only the formatter tags are allowed.

      Sending XML messages

    If the file starts with an XML header ('<?xml...'), then it processed as an XML file. GCALDaemon detects file encoding by the XML header's encoding property. All descriptions of the properties are same as attributes/properties associated with structured text messages. GCALDaemon detects HTML tags in the <body> element, and changes the mail's content type to "text/html". GCALDaemon ignores all unknown/undefined XML attributes, elements, CDATA sections, namespaces, etc.


      Sending messages from your application

    Writing files is actually fairly easy in all programming languages and scripts. More easier than implement the a new mail sender (connection pool, SSL communicator, character and password encoder, firewall handler, etc) from scratch. You can save your time by using GCALDaemon's mail transfer agent to create your own home application. Sample Java code:

    // Mail parameters
    String to = "recipient@sample.mail.com";
    String subject = "Mail's subject";
    String body = "This is the body of my mail message.";

    // Create file's content
    String mail = "ENCODING:UTF-8\r\nTO:" + to + "\r\nSUBJECT:" + subject
        + "\r\n" + body;
    byte[] bytes = mail.getBytes("UTF8");
    String path = "/outbox/" + System.currentTimeMillis()
        + mail.hashCode() + ".txt";

    // Save file
    RandomAccessFile file = null;
    try {
       file = new RandomAccessFile(path, "rw");
       file.write(bytes);  
    } finally {
       if (file != null) {
          file.close();
       }
    }

      Fine adjustment

    1) If you use Google Apps For Your Domain you may need to clear a captcha for your email account. Visit

    https://www.google.com/a/yourdomain.org/UnlockCaptcha

    then enter your email username and password, and the letters in the distorted picture. Be sure to replace 'yourdomain.org' with your domain name.

    2) Optionally start the 'service-install.bat' to install GCALDaemon as Windows service (on UNIX-compatible systems put GCALDaemon into 'init', 'launchd' or 'rc' script). Before uninstall GCALDaemon, you must stop and uninstall this service (with 'service-stop.bat' and 'service-uninstall.bat'). Please note, this is the last step in the setup/configuration process, do not install the service while GCALDaemon is not running properly. On Vista, it's not enough to be in the Administrators group, you need to either be actually logged on as the Administrator.

    A) In START menu click on the 'Command Prompt'
    B) Right click on it and select 'Properties'
    C) In 'Shortcut' tab, click on 'Advanced...'
    D) Tick the 'Run as Administrator'
    E) Run 'Command Prompt' and in click 'Continue' in 'User Account Control' box
    F) Now you are in administrator mode
    G) Type 'cd [gcaldaemon installation directory]\bin'
    H) Execute 'service-install.bat'
    I) Execute 'service-start.bat'

    APACHE LICENSE VERSION 2.0