/usr/share/doc/libcommons-net2-java/api/org/apache/commons/net/smtp/SMTPClient.html is in libcommons-net2-java-doc 2.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_03) on Wed May 30 10:19:43 UTC 2012 -->
<title>SMTPClient (libcommons-net2-java API)</title>
<meta name="date" content="2012-05-30">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SMTPClient (libcommons-net2-java API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/net/smtp/SMTPCommand.html" title="class in org.apache.commons.net.smtp"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/net/smtp/SMTPClient.html" target="_top">Frames</a></li>
<li><a href="SMTPClient.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#fields_inherited_from_class_org.apache.commons.net.smtp.SMTP">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.net.smtp</div>
<h2 title="Class SMTPClient" class="title">Class SMTPClient</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/apache/commons/net/SocketClient.html" title="class in org.apache.commons.net">org.apache.commons.net.SocketClient</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp">org.apache.commons.net.smtp.SMTP</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.net.smtp.SMTPClient</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">SMTPClient</span>
extends <a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp">SMTP</a></pre>
<div class="block">SMTPClient encapsulates all the functionality necessary to send files
through an SMTP server. This class takes care of all
low level details of interacting with an SMTP server and provides
a convenient higher level interface. As with all classes derived
from <a href="../../../../../org/apache/commons/net/SocketClient.html" title="class in org.apache.commons.net"><code>SocketClient</code></a>,
you must first connect to the server with
<a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.net.InetAddress, int)"><code>connect </code></a>
before doing anything, and finally
<a href="../../../../../org/apache/commons/net/SocketClient.html#disconnect()"><code>disconnect </code></a>
after you're completely finished interacting with the server.
Then you need to check the SMTP reply code to see if the connection
was successful. For example:
<pre>
try {
int reply;
client.connect("mail.foobar.com");
System.out.print(client.getReplyString());
// After connection attempt, you should check the reply code to verify
// success.
reply = client.getReplyCode();
if(!SMTPReply.isPositiveCompletion(reply)) {
client.disconnect();
System.err.println("SMTP server refused connection.");
System.exit(1);
}
// Do useful stuff here.
...
} catch(IOException e) {
if(client.isConnected()) {
try {
client.disconnect();
} catch(IOException f) {
// do nothing
}
}
System.err.println("Could not connect to server.");
e.printStackTrace();
System.exit(1);
}
</pre>
<p>
Immediately after connecting is the only real time you need to check the
reply code (because connect is of type void). The convention for all the
SMTP command methods in SMTPClient is such that they either return a
boolean value or some other value.
The boolean methods return true on a successful completion reply from
the SMTP server and false on a reply resulting in an error condition or
failure. The methods returning a value other than boolean return a value
containing the higher level data produced by the SMTP command, or null if a
reply resulted in an error condition or failure. If you want to access
the exact SMTP reply code causing a success or failure, you must call
<a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyCode()"><code>getReplyCode </code></a> after
a success or failure.
<p>
You should keep in mind that the SMTP server may choose to prematurely
close a connection for various reasons. The SMTPClient class will detect a
premature SMTP server connection closing when it receives a
<a href="../../../../../org/apache/commons/net/smtp/SMTPReply.html#SERVICE_NOT_AVAILABLE"><code>SMTPReply.SERVICE_NOT_AVAILABLE </code></a>
response to a command.
When that occurs, the method encountering that reply will throw
an <a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp"><code>SMTPConnectionClosedException</code></a>
.
<code>SMTPConectionClosedException</code>
is a subclass of <code> IOException </code> and therefore need not be
caught separately, but if you are going to catch it separately, its
catch block must appear before the more general <code> IOException </code>
catch block. When you encounter an
<a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp"><code>SMTPConnectionClosedException</code></a>
, you must disconnect the connection with
<a href="../../../../../org/apache/commons/net/smtp/SMTP.html#disconnect()"><code>disconnect() </code></a> to properly clean up the
system resources used by SMTPClient. Before disconnecting, you may check
the last reply code and text with
<a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyCode()"><code>getReplyCode </code></a>,
<a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyString()"><code>getReplyString </code></a>,
and
<a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyStrings()"><code>getReplyStrings</code></a>.
<p>
Rather than list it separately for each method, we mention here that
every method communicating with the server and throwing an IOException
can also throw a
<a href="../../../../../org/apache/commons/net/MalformedServerReplyException.html" title="class in org.apache.commons.net"><code>MalformedServerReplyException</code></a>
, which is a subclass
of IOException. A MalformedServerReplyException will be thrown when
the reply received from the server deviates enough from the protocol
specification that it cannot be interpreted in a useful manner despite
attempts to be as lenient as possible.
<p>
<p></div>
<dl><dt><span class="strong">Author:</span></dt>
<dd>Daniel F. Savarese</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp"><code>SMTP</code></a>,
<a href="../../../../../org/apache/commons/net/smtp/SimpleSMTPHeader.html" title="class in org.apache.commons.net.smtp"><code>SimpleSMTPHeader</code></a>,
<a href="../../../../../org/apache/commons/net/smtp/RelayPath.html" title="class in org.apache.commons.net.smtp"><code>RelayPath</code></a>,
<a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp"><code>SMTPConnectionClosedException</code></a>,
<a href="../../../../../org/apache/commons/net/MalformedServerReplyException.html" title="class in org.apache.commons.net"><code>MalformedServerReplyException</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.commons.net.smtp.SMTP">
<!-- -->
</a>
<h3>Fields inherited from class org.apache.commons.net.smtp.<a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp">SMTP</a></h3>
<code><a href="../../../../../org/apache/commons/net/smtp/SMTP.html#_commandSupport_">_commandSupport_</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#DEFAULT_PORT">DEFAULT_PORT</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.commons.net.SocketClient">
<!-- -->
</a>
<h3>Fields inherited from class org.apache.commons.net.<a href="../../../../../org/apache/commons/net/SocketClient.html" title="class in org.apache.commons.net">SocketClient</a></h3>
<code><a href="../../../../../org/apache/commons/net/SocketClient.html#_defaultPort_">_defaultPort_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#_input_">_input_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#_output_">_output_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#_serverSocketFactory_">_serverSocketFactory_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#_socket_">_socket_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#_socketFactory_">_socketFactory_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#_timeout_">_timeout_</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#connectTimeout">connectTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#NETASCII_EOL">NETASCII_EOL</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#SMTPClient()">SMTPClient</a></strong>()</code>
<div class="block">Default SMTPClient constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#SMTPClient(java.lang.String)">SMTPClient</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</code>
<div class="block">Overloaded constructor that takes an encoding specification</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#addRecipient(org.apache.commons.net.smtp.RelayPath)">addRecipient</a></strong>(<a href="../../../../../org/apache/commons/net/smtp/RelayPath.html" title="class in org.apache.commons.net.smtp">RelayPath</a> path)</code>
<div class="block">Add a recipient for a message using the SMTP RCPT command, specifying
a forward relay path.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#addRecipient(java.lang.String)">addRecipient</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> address)</code>
<div class="block">Add a recipient for a message using the SMTP RCPT command, the
recipient's email address.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#completePendingCommand()">completePendingCommand</a></strong>()</code>
<div class="block">At least one SMTPClient method (<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendMessageData()"><code>sendMessageData </code></a>)
does not complete the entire sequence of SMTP commands to complete a
transaction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#listHelp()">listHelp</a></strong>()</code>
<div class="block">Fetches the system help information from the server and returns the
full string.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#listHelp(java.lang.String)">listHelp</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> command)</code>
<div class="block">Fetches the help information for a given command from the server and
returns the full string.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#login()">login</a></strong>()</code>
<div class="block">Login to the SMTP server by sending the HELO command with the
client hostname as an argument.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#login(java.lang.String)">login</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> hostname)</code>
<div class="block">Login to the SMTP server by sending the HELO command with the
given hostname as an argument.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#logout()">logout</a></strong>()</code>
<div class="block">Logout of the SMTP server by sending the QUIT command.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#reset()">reset</a></strong>()</code>
<div class="block">Aborts the current mail transaction, resetting all server stored
sender, recipient, and mail data, cleaing all buffers and tables.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendMessageData()">sendMessageData</a></strong>()</code>
<div class="block">Send the SMTP DATA command in preparation to send an email message.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendNoOp()">sendNoOp</a></strong>()</code>
<div class="block">Sends a NOOP command to the SMTP server.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendShortMessageData(java.lang.String)">sendShortMessageData</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)</code>
<div class="block">A convenience method for sending short messages.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendSimpleMessage(java.lang.String, java.lang.String[], java.lang.String)">sendSimpleMessage</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> sender,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] recipients,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)</code>
<div class="block">A convenience method for a sending short email without having to
explicitly set the sender and recipient(s).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendSimpleMessage(java.lang.String, java.lang.String, java.lang.String)">sendSimpleMessage</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> sender,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> recipient,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)</code>
<div class="block">A convenience method for a sending short email without having to
explicitly set the sender and recipient(s).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#setSender(org.apache.commons.net.smtp.RelayPath)">setSender</a></strong>(<a href="../../../../../org/apache/commons/net/smtp/RelayPath.html" title="class in org.apache.commons.net.smtp">RelayPath</a> path)</code>
<div class="block">Set the sender of a message using the SMTP MAIL command, specifying
a reverse relay path.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#setSender(java.lang.String)">setSender</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> address)</code>
<div class="block">Set the sender of a message using the SMTP MAIL command, specifying
the sender's email address.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#verify(java.lang.String)">verify</a></strong>(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> username)</code>
<div class="block">Verify that a username or email address is valid, i.e., that mail
can be delivered to that mailbox on the server.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.commons.net.smtp.SMTP">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.commons.net.smtp.<a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp">SMTP</a></h3>
<code><a href="../../../../../org/apache/commons/net/smtp/SMTP.html#_connectAction_()">_connectAction_</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#addProtocolCommandListener(org.apache.commons.net.ProtocolCommandListener)">addProtocolCommandListener</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#data()">data</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#disconnect()">disconnect</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#expn(java.lang.String)">expn</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReply()">getReply</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyCode()">getReplyCode</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyString()">getReplyString</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#getReplyStrings()">getReplyStrings</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#helo(java.lang.String)">helo</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#help()">help</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#help(java.lang.String)">help</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#mail(java.lang.String)">mail</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#noop()">noop</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#quit()">quit</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#rcpt(java.lang.String)">rcpt</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#removeProtocolCommandistener(org.apache.commons.net.ProtocolCommandListener)">removeProtocolCommandistener</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#rset()">rset</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#saml(java.lang.String)">saml</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#send(java.lang.String)">send</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#sendCommand(int)">sendCommand</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#sendCommand(int, java.lang.String)">sendCommand</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#sendCommand(java.lang.String)">sendCommand</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#sendCommand(java.lang.String, java.lang.String)">sendCommand</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#soml(java.lang.String)">soml</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#turn()">turn</a>, <a href="../../../../../org/apache/commons/net/smtp/SMTP.html#vrfy(java.lang.String)">vrfy</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.commons.net.SocketClient">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.commons.net.<a href="../../../../../org/apache/commons/net/SocketClient.html" title="class in org.apache.commons.net">SocketClient</a></h3>
<code><a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.net.InetAddress)">connect</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.net.InetAddress, int)">connect</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.net.InetAddress, int, java.net.InetAddress, int)">connect</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.lang.String)">connect</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.lang.String, int)">connect</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#connect(java.lang.String, int, java.net.InetAddress, int)">connect</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getConnectTimeout()">getConnectTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getDefaultPort()">getDefaultPort</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getDefaultTimeout()">getDefaultTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getKeepAlive()">getKeepAlive</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getLocalAddress()">getLocalAddress</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getLocalPort()">getLocalPort</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getRemoteAddress()">getRemoteAddress</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getRemotePort()">getRemotePort</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getServerSocketFactory()">getServerSocketFactory</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getSoLinger()">getSoLinger</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getSoTimeout()">getSoTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#getTcpNoDelay()">getTcpNoDelay</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#isConnected()">isConnected</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setConnectTimeout(int)">setConnectTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setDefaultPort(int)">setDefaultPort</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setDefaultTimeout(int)">setDefaultTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setKeepAlive(boolean)">setKeepAlive</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setReceiveBufferSize(int)">setReceiveBufferSize</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setSendBufferSize(int)">setSendBufferSize</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setServerSocketFactory(javax.net.ServerSocketFactory)">setServerSocketFactory</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setSocketFactory(javax.net.SocketFactory)">setSocketFactory</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setSoLinger(boolean, int)">setSoLinger</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setSoTimeout(int)">setSoTimeout</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#setTcpNoDelay(boolean)">setTcpNoDelay</a>, <a href="../../../../../org/apache/commons/net/SocketClient.html#verifyRemote(java.net.Socket)">verifyRemote</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="SMTPClient()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SMTPClient</h4>
<pre>public SMTPClient()</pre>
<div class="block">Default SMTPClient constructor. Creates a new SMTPClient instance.</div>
</li>
</ul>
<a name="SMTPClient(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SMTPClient</h4>
<pre>public SMTPClient(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</pre>
<div class="block">Overloaded constructor that takes an encoding specification</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>encoding</code> - The encoding to use</dd><dt><span class="strong">Since:</span></dt>
<dd>2.0</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="completePendingCommand()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>completePendingCommand</h4>
<pre>public boolean completePendingCommand()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">At least one SMTPClient method (<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendMessageData()"><code>sendMessageData </code></a>)
does not complete the entire sequence of SMTP commands to complete a
transaction. These types of commands require some action by the
programmer after the reception of a positive intermediate command.
After the programmer's code completes its actions, it must call this
method to receive the completion reply from the server and verify the
success of the entire transaction.
<p>
For example,
<pre>
writer = client.sendMessage();
if(writer == null) // failure
return false;
header =
new SimpleSMTPHeader("foobar@foo.com", "foo@foobar.com", "Re: Foo");
writer.write(header.toString());
writer.write("This is just a test");
writer.close();
if(!client.completePendingCommand()) // failure
return false;
</pre>
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="login(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>login</h4>
<pre>public boolean login(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> hostname)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Login to the SMTP server by sending the HELO command with the
given hostname as an argument. Before performing any mail commands,
you must first login.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>hostname</code> - The hostname with which to greet the SMTP server.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="login()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>login</h4>
<pre>public boolean login()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Login to the SMTP server by sending the HELO command with the
client hostname as an argument. Before performing any mail commands,
you must first login.
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="setSender(org.apache.commons.net.smtp.RelayPath)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSender</h4>
<pre>public boolean setSender(<a href="../../../../../org/apache/commons/net/smtp/RelayPath.html" title="class in org.apache.commons.net.smtp">RelayPath</a> path)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Set the sender of a message using the SMTP MAIL command, specifying
a reverse relay path. The sender must be set first before any
recipients may be specified, otherwise the mail server will reject
your commands.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>path</code> - The reverse relay path pointing back to the sender.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="setSender(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSender</h4>
<pre>public boolean setSender(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> address)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Set the sender of a message using the SMTP MAIL command, specifying
the sender's email address. The sender must be set first before any
recipients may be specified, otherwise the mail server will reject
your commands.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>address</code> - The sender's email address.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="addRecipient(org.apache.commons.net.smtp.RelayPath)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addRecipient</h4>
<pre>public boolean addRecipient(<a href="../../../../../org/apache/commons/net/smtp/RelayPath.html" title="class in org.apache.commons.net.smtp">RelayPath</a> path)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Add a recipient for a message using the SMTP RCPT command, specifying
a forward relay path. The sender must be set first before any
recipients may be specified, otherwise the mail server will reject
your commands.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>path</code> - The forward relay path pointing to the recipient.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="addRecipient(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addRecipient</h4>
<pre>public boolean addRecipient(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> address)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Add a recipient for a message using the SMTP RCPT command, the
recipient's email address. The sender must be set first before any
recipients may be specified, otherwise the mail server will reject
your commands.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>address</code> - The recipient's email address.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="sendMessageData()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendMessageData</h4>
<pre>public <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> sendMessageData()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Send the SMTP DATA command in preparation to send an email message.
This method returns a DotTerminatedMessageWriter instance to which
the message can be written. Null is returned if the DATA command
fails.
<p>
You must not issue any commands to the SMTP server (i.e., call any
(other methods) until you finish writing to the returned Writer
instance and close it. The SMTP protocol uses the same stream for
issuing commands as it does for returning results. Therefore the
returned Writer actually writes directly to the SMTP connection.
After you close the writer, you can execute new commands. If you
do not follow these requirements your program will not work properly.
<p>
You can use the provided
<a href="../../../../../org/apache/commons/net/smtp/SimpleSMTPHeader.html" title="class in org.apache.commons.net.smtp"><code>SimpleSMTPHeader</code></a>
class to construct a bare minimum header.
To construct more complicated headers you should
refer to RFC 822. When the Java Mail API is finalized, you will be
able to use it to compose fully compliant Internet text messages.
The DotTerminatedMessageWriter takes care of doubling line-leading
dots and ending the message with a single dot upon closing, so all
you have to worry about is writing the header and the message.
<p>
Upon closing the returned Writer, you need to call
<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#completePendingCommand()"><code>completePendingCommand() </code></a>
to finalize the transaction and verify its success or failure from
the server reply.
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>A DotTerminatedMessageWriter to which the message (including
header) can be written. Returns null if the command fails.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="sendShortMessageData(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendShortMessageData</h4>
<pre>public boolean sendShortMessageData(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">A convenience method for sending short messages. This method fetches
the Writer returned by <a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendMessageData()"><code>sendMessageData() </code></a>
and writes the specified String to it. After writing the message,
this method calls <a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#completePendingCommand()"><code>completePendingCommand() </code></a>
to finalize the transaction and returns
its success or failure.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>message</code> - The short email message to send.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="sendSimpleMessage(java.lang.String, java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendSimpleMessage</h4>
<pre>public boolean sendSimpleMessage(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> sender,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> recipient,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">A convenience method for a sending short email without having to
explicitly set the sender and recipient(s). This method
sets the sender and recipient using
<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#setSender(org.apache.commons.net.smtp.RelayPath)"><code>setSender </code></a> and
<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#addRecipient(org.apache.commons.net.smtp.RelayPath)"><code>addRecipient </code></a>, and then sends the
message using <a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendShortMessageData(java.lang.String)"><code>sendShortMessageData </code></a>.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sender</code> - The email address of the sender.</dd><dd><code>recipient</code> - The email address of the recipient.</dd><dd><code>message</code> - The short email message to send.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="sendSimpleMessage(java.lang.String, java.lang.String[], java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendSimpleMessage</h4>
<pre>public boolean sendSimpleMessage(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> sender,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] recipients,
<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">A convenience method for a sending short email without having to
explicitly set the sender and recipient(s). This method
sets the sender and recipients using
<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#setSender(org.apache.commons.net.smtp.RelayPath)"><code>setSender </code></a> and
<a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#addRecipient(org.apache.commons.net.smtp.RelayPath)"><code>addRecipient </code></a>, and then sends the
message using <a href="../../../../../org/apache/commons/net/smtp/SMTPClient.html#sendShortMessageData(java.lang.String)"><code>sendShortMessageData </code></a>.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sender</code> - The email address of the sender.</dd><dd><code>recipients</code> - An array of recipient email addresses.</dd><dd><code>message</code> - The short email message to send.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="logout()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>logout</h4>
<pre>public boolean logout()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Logout of the SMTP server by sending the QUIT command.
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="reset()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reset</h4>
<pre>public boolean reset()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Aborts the current mail transaction, resetting all server stored
sender, recipient, and mail data, cleaing all buffers and tables.
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="verify(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>verify</h4>
<pre>public boolean verify(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> username)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Verify that a username or email address is valid, i.e., that mail
can be delivered to that mailbox on the server.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>username</code> - The username or email address to validate.</dd>
<dt><span class="strong">Returns:</span></dt><dd>True if the username is valid, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="listHelp()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>listHelp</h4>
<pre>public <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> listHelp()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Fetches the system help information from the server and returns the
full string.
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The system help string obtained from the server. null if the
information could not be obtained.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="listHelp(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>listHelp</h4>
<pre>public <a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> listHelp(<a href="file:///usr/share/doc/default-jdk-doc/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> command)
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Fetches the help information for a given command from the server and
returns the full string.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>command</code> - The command on which to ask for help.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The command help string obtained from the server. null if the
information could not be obtained.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
<a name="sendNoOp()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>sendNoOp</h4>
<pre>public boolean sendNoOp()
throws <a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Sends a NOOP command to the SMTP server. This is useful for preventing
server timeouts.
<p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if successfully completed, false if not.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/net/smtp/SMTPConnectionClosedException.html" title="class in org.apache.commons.net.smtp">SMTPConnectionClosedException</a></code> - If the SMTP server prematurely closes the connection as a result
of the client being idle or some other reason causing the server
to send SMTP reply code 421. This exception may be caught either
as an IOException or independently as itself.</dd>
<dd><code><a href="file:///usr/share/doc/default-jdk-doc/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - If an I/O error occurs while either sending a
command to the server or receiving a reply from the server.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/net/smtp/SMTP.html" title="class in org.apache.commons.net.smtp"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/net/smtp/SMTPCommand.html" title="class in org.apache.commons.net.smtp"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/net/smtp/SMTPClient.html" target="_top">Frames</a></li>
<li><a href="SMTPClient.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#fields_inherited_from_class_org.apache.commons.net.smtp.SMTP">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|