Windows Runtime – C# Send EMail from App


I’m working on my About page for a Windows Phone Runtime app and needed to be able to send an email for feedback or support issues.

Below is the code for my event handler in the code behind (AboutPage.cs):

        async private void Image_Email(object sender, TappedRoutedEventArgs e)
            //Define email address to send to
            EmailRecipient sendTo = new EmailRecipient()
                Address = ""

            //New email and define email subject
            EmailMessage mail = new EmailMessage();
            mail.Subject = "Linux Essentials - Feedback";

            //Add addressee to email

            //Open share contact with email only
            await EmailManager.ShowComposeNewEmailAsync(mail);

The XAML on my About page is simply an image with the Tapped event:

      <Image Source="Assets/Images/Mail.png"

When defining a new email you can also specify the mail body text:

mail.Body = "this is the Body";



Configuring Feng Office 1.7.4 Community Edition To Send Email Via Gmail – Ubuntu Server 10.4 Lucid

In my previous post I installed Feng Office 1.7.4 Community Edition on Ubuntu Server 10.4 Lucid.

With the installation complete, I wanted to configure Feng Office to send and receive emails and found that the best option (for me) was to configure Feng Office to use Gmail.

I set up an additional Gmail account for the Feng Office Administrator to use as I already had a Gmail account for myself.

Note: I did also configure Feng Office to connect to my Hotmail / Windows Live account – but currently Feng Office only allows me to receive emails from this account.

The first step that you need to complete once you have a Gmail account is to enable IMAP. Log in to Gmail and then click Options cog at the top right of the screen – then click the Mail Settings link.

Click the Enable IMAP radio button and then click the Save Changes button.

That is all we need to do on the Gmail side of things so the next step is to configure the Feng Office Admin account to send emails via our Gmail account. This will enable users to receive reminders and other system generated emails.

Log in to Feng Office as the Administrator and then click the Administration link:

Click the Configuration button:

Click on the Mailing link:

Below you can see how I set the options to connect to my Gmail account. Obviously you will need to change the Gmail email address to the one that you want to use. Click Save.

Setting up a Gmail account for a user is a little different. If you need to add a user just click Administration followed by the Add user link:

Type in the User name and their Gmail address and then click Add user:

Click Administration again and then click Add Email account:

This is how I configured the incoming email settings for my user account (I have removed the first part of my gmail address). You will need to use an email address that is different from the Admin user Gmail address:

Below is my configuration for the SMTP settings:

Update: This seemed to be enough to get things working until I upgraded to Feng Office 1.7.5 – though I cannot be sure that upgrading was the trigger that prevented the Feng Office admin account from sending emails.

If we first look at the cron settings in the Admin panel in Feng Office (Log in as Admin and click Administration then Cron events) we can see that it is set to check for emails every ten minutes:

The solution was to create a cronjob that calls on the cron.php file which resides in the root of the Feng Office installation folder, as follows:

sudo crontab -e

I set my cron job to run every minute as signified by the five asterisks – followed by the script to call on cron.php.

* * * * * sudo wget -O - -q http://<server-ip>/feng_community/cron.php

You can change this to run the cron job as often as you would like – you will need to change the IP address to that of your server – and you may need to adjust the path to cron.php depending on your installation.

The frequency of this cron job can over-ride the settings that you specify within the Cron events page in the Feng Office admin panel. For example, if you configure a cron job to run every five minutes, and you configure the cron event to check for upgrades every one minute, it will only be able to check for upgrades every five minutes.

This setup was enough to get the Admin user to send notifications to Feng Office users and for me to be able to send and receive emails within Feng Office.

There are plenty of other options that can be set and so I would recommend that you read the Feng Office Wiki pages that deals with Setup and  Email here and here.

Support is also available from the Feng Office Forum.

Ubuntu 10.4 Lucid – Configuring Evolution To Connect to Hotmail / Windows Live Mail

Sometimes it is nice to have a local copy of your email in an email client, so today I am configuring Evolution in Ubuntu 10.4 to connect to my Hotmail account.

First click the envelope icon at the top of the screen and then select Set Up Mail from the drop down menu.

The Evolution Setup Assistant will open – click the Forward button to continue. We are not restoring from a previous backup so click Forward again.

On the Identity window enter your full name and email address and click Forward.

Configure the Receiving Email screen as pictured below and then click Forward:

On the next page of the wizard I checked the boxes to Check for new messages every ten minutes and to Leave messages on server – you can configure this screen however it suits you best. Click Forward.

Configure the Sending Email screen as pictured below and then click Forward:

Note: Use if port 25 does not work (as per Ed’s response in the Comments below).

On the Account Management screen simply provide a name by which you would like to refer to this email account, such as “Personal” for example, then click Forward.

Click Apply to finish the wizard and Evolution will open and prompt you for your Hotmail / Live email password. Enter your password and leave the Remember this password box checked (unless you want to enter your password each time you open Evolution).

That’s it – Evolution will now download your email from Windows Live!

Source: Jaqoup’s Weblog