Skip to content

Commit f9f9321

Browse files
committed
fix mailparser/mailparser-tests.ts
1 parent 4dc4744 commit f9f9321

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

mailparser/mailparser-tests.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference path="./mailparser.d.ts" />
2+
13
import mailparser_mod = require("mailparser");
24
import MailParser = mailparser_mod.MailParser;
35
import ParsedMail = mailparser_mod.ParsedMail;
@@ -12,25 +14,25 @@ mailparser.on("headers", function(headers){
1214
});
1315

1416
mailparser.on("end", function(mail){
15-
mail; // object structure for parsed e-mail
17+
mail; // object structure for parsed e-mail
1618
});
17-
19+
1820

1921
// Decode a simple e-mail
2022
// This example decodes an e-mail from a string
21-
23+
2224
var email = "From: 'Sender Name' <sender@example.com>\r\n"+
2325
"To: 'Receiver Name' <receiver@example.com>\r\n"+
2426
"Subject: Hello world!\r\n"+
2527
"\r\n"+
2628
"How are you today?";
27-
// setup an event listener when the parsing finishes
29+
// setup an event listener when the parsing finishes
2830
mailparser.on("end", function(mail_object){
29-
console.log("From:", mail_object.from); //[{address:'sender@example.com',name:'Sender Name'}]
30-
console.log("Subject:", mail_object.subject); // Hello world!
31-
console.log("Text body:", mail_object.text); // How are you today?
31+
console.log("From:", mail_object.from); //[{address:'sender@example.com',name:'Sender Name'}]
32+
console.log("Subject:", mail_object.subject); // Hello world!
33+
console.log("Text body:", mail_object.text); // How are you today?
3234
});
33-
// send the email source to the parser
35+
// send the email source to the parser
3436
mailparser.write(email);
3537
mailparser.end();
3638

@@ -42,7 +44,7 @@ import fs = require("fs");
4244
mailparser.on("end", function(mail_object){
4345
console.log("Subject:", mail_object.subject);
4446
});
45-
47+
4648
fs.createReadStream("email.eml").pipe(mailparser);
4749

4850

@@ -63,7 +65,3 @@ mp.on("attachment", function(attachment, mail){
6365
var output = fs.createWriteStream(attachment.generatedFileName);
6466
attachment.stream.pipe(output);
6567
});
66-
67-
68-
69-

0 commit comments

Comments
 (0)