File: MailClientTest.C

package info (click to toggle)
witty 3.2.1-2%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 70,436 kB
  • sloc: cpp: 117,095; ansic: 77,999; xml: 7,564; sh: 1,037; perl: 208; makefile: 144; java: 86; sql: 14
file content (46 lines) | stat: -rw-r--r-- 1,235 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (C) 2011 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#include <iostream>
#include <boost/test/unit_test.hpp>

#include <Wt/Mail/Client>
#include <Wt/Mail/Message>

using namespace Wt;
using namespace Wt::Mail;

BOOST_AUTO_TEST_CASE( mail_test1 )
{
  Message m;
  m.setFrom(Mailbox("bas@kode.be", "Bas Deforche"));
  m.addRecipient(To, Mailbox("koen@emweb.be", "Koen Deforche"));
  m.addRecipient(Bcc,
		 Mailbox("koen.deforche@gmail.com",
			 WString::fromUTF8("Koen Deforche")));
  m.setSubject(WString::fromUTF8("Hey there, \xe2\x82\xac !"));
  m.setBody(WString::fromUTF8
	    ("Body here \xe2\x82\xac\n"
	     "We have been working hard\n"
	     ".beware this\n"
	     "And long lines should be properly split using a soft line end,"
	     "let's see how that turns out."));
  m.addHtmlBody(WString::fromUTF8
		("<div>"
		 "<h1>HTML body here</h1>"
		 "Long lines should be properly split using a soft line "
		 "end, let's see how that turns out.<br>"
		 "This is necessary to make lots of \xe2\x82\xac! "
		 "Please visit <a href=\"http://www.emweb.be\">Emweb</a>."
		 "</div>"));

#if 0
  Client c;
  c.connect("localhost");
  c.send(m);
#else
  m.write(std::cout);
#endif
}