Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ivan  
#1 Posted : Thursday, June 2, 2011 5:29:21 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)
JavaScript Example
The following code demonstrates how to parse from, to, cc, subject, body text, attachments of an EML file.

Code:


try {
    var oMail = new ActiveXObject("EAGetMailObj.Mail");
    oMail.LicenseCode = "TryIt";

    oMail.LoadFile("d:\\test.eml", false);

    WScript.Echo("From: " + oMail.From.Address);
    WScript.Echo("Subject: " + oMail.Subject);

    var rcpts = new VBArray(oMail.To).toArray();
    for (var i = 0; i < rcpts.length; i++) {
        var rcpt = rcpts[i];
        WScript.Echo("To: " + rcpt.Address);
    }

    var cc_rcpts = new VBArray(oMail.CC).toArray();
    for (var i = 0; i < cc_rcpts.length; i++) {
        var rcpt = cc_rcpts[i];
        WScript.Echo("To: " + rcpt.Address);
    }

    var atts = new VBArray(oMail.Attachments).toArray();
    for (var i = 0; i < atts.length; i++) {
        var att = atts[i];
        WScript.Echo("Attachment: " + att.Name);
        // you can also save the attachment like this
        att.SaveAs("d:\\" + att.Name, true);
    }

    WScript.Echo("Text Body:");
    WScript.Echo(oMail.TextBody);

    WScript.Echo("Html Body:");
    WScript.Echo(oMail.HtmlBody);

}
catch ( err) {
    WScript.Echo(err.description);
}

Edited by user Thursday, June 2, 2011 5:30:09 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.037 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.