Skip to content

Instantly share code, notes, and snippets.

@QGao
Created May 1, 2012 00:37
Show Gist options
  • Save QGao/2564011 to your computer and use it in GitHub Desktop.
Save QGao/2564011 to your computer and use it in GitHub Desktop.
A sample for sending email.
var win = Ti.UI.createWindow();
var label1 = Ti.UI.createLabel
({
text:'Some Documents listed',
font:{fontWeight:'bold', fontSize:14},
color: '#8c0000',
height: 'auto',
left: 10,
top:10
});
win.add(label1);
var emailContents = Ti.UI.createLabel
({
text:'Some email contents to send',
font:{fontSize:14},
color: '#fff',
height: 'auto',
left: 10,
top:30
});
win.add(emailContents);
var buttonBar = Titanium.UI.createButtonBar({
width:200,
height:25,
top:100,
labels:['Email your documents'],
backgroundColor:'#8c0000',
style:Titanium.UI.iPhone.SystemButtonStyle.BAR
});
buttonBar.addEventListener('click', function(e)
{
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.subject = "Fund Documents Request ";
emailDialog.toRecipients = ['who@email.com'];
emailDialog.messageBody = emailContents.text;
//var f = Ti.Filesystem.getFile('whatever.pdf');
//emailDialog.addAttachment(f);
emailDialog.open();
});
win.add(buttonBar);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment