Revision 1374
Added by Luisehahne almost 15 years ago
| class.smtp.php | ||
|---|---|---|
| 60 | 60 |
var $do_verp = false; |
| 61 | 61 |
|
| 62 | 62 |
/**#@+ |
| 63 |
* @access private
|
|
| 63 |
* @access private |
|
| 64 | 64 |
*/ |
| 65 | 65 |
var $smtp_conn; # the socket to the server |
| 66 | 66 |
var $error; # error if any on the last call |
| ... | ... | |
| 69 | 69 |
|
| 70 | 70 |
/** |
| 71 | 71 |
* Initialize the class so that the data is in a known state. |
| 72 |
* @access public
|
|
| 73 |
* @return void
|
|
| 72 |
* @access public |
|
| 73 |
* @return void |
|
| 74 | 74 |
*/ |
| 75 | 75 |
function SMTP() {
|
| 76 | 76 |
$this->smtp_conn = 0; |
| ... | ... | |
| 94 | 94 |
* |
| 95 | 95 |
* SMTP CODE SUCCESS: 220 |
| 96 | 96 |
* SMTP CODE FAILURE: 421 |
| 97 |
* @access public
|
|
| 98 |
* @return bool
|
|
| 97 |
* @access public |
|
| 98 |
* @return bool |
|
| 99 | 99 |
*/ |
| 100 | 100 |
function Connect($host,$port=0,$tval=30) {
|
| 101 | 101 |
# set the error val to null so there is no confusion |
| ... | ... | |
| 155 | 155 |
/** |
| 156 | 156 |
* Performs SMTP authentication. Must be run after running the |
| 157 | 157 |
* Hello() method. Returns true if successfully authenticated. |
| 158 |
* @access public
|
|
| 159 |
* @return bool
|
|
| 158 |
* @access public |
|
| 159 |
* @return bool |
|
| 160 | 160 |
*/ |
| 161 | 161 |
function Authenticate($username, $password) {
|
| 162 | 162 |
// Start authentication |
| ... | ... | |
| 218 | 218 |
|
| 219 | 219 |
/** |
| 220 | 220 |
* Returns true if connected to a server otherwise false |
| 221 |
* @access private
|
|
| 222 |
* @return bool
|
|
| 221 |
* @access private |
|
| 222 |
* @return bool |
|
| 223 | 223 |
*/ |
| 224 | 224 |
function Connected() {
|
| 225 | 225 |
if(!empty($this->smtp_conn)) {
|
| ... | ... | |
| 243 | 243 |
* Closes the socket and cleans up the state of the class. |
| 244 | 244 |
* It is not considered good to use this function without |
| 245 | 245 |
* first trying to use QUIT. |
| 246 |
* @access public
|
|
| 247 |
* @return void
|
|
| 246 |
* @access public |
|
| 247 |
* @return void |
|
| 248 | 248 |
*/ |
| 249 | 249 |
function Close() {
|
| 250 | 250 |
$this->error = null; # so there is no confusion |
| ... | ... | |
| 276 | 276 |
* SMTP CODE FAILURE: 552,554,451,452 |
| 277 | 277 |
* SMTP CODE FAILURE: 451,554 |
| 278 | 278 |
* SMTP CODE ERROR : 500,501,503,421 |
| 279 |
* @access public
|
|
| 280 |
* @return bool
|
|
| 279 |
* @access public |
|
| 280 |
* @return bool |
|
| 281 | 281 |
*/ |
| 282 | 282 |
function Data($msg_data) {
|
| 283 | 283 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 415 | 415 |
* SMTP CODE SUCCESS: 250 |
| 416 | 416 |
* SMTP CODE FAILURE: 550 |
| 417 | 417 |
* SMTP CODE ERROR : 500,501,502,504,421 |
| 418 |
* @access public
|
|
| 419 |
* @return string array
|
|
| 418 |
* @access public |
|
| 419 |
* @return string array |
|
| 420 | 420 |
*/ |
| 421 | 421 |
function Expand($name) {
|
| 422 | 422 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 466 | 466 |
* |
| 467 | 467 |
* SMTP CODE SUCCESS: 250 |
| 468 | 468 |
* SMTP CODE ERROR : 500, 501, 504, 421 |
| 469 |
* @access public
|
|
| 470 |
* @return bool
|
|
| 469 |
* @access public |
|
| 470 |
* @return bool |
|
| 471 | 471 |
*/ |
| 472 | 472 |
function Hello($host="") {
|
| 473 | 473 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 498 | 498 |
|
| 499 | 499 |
/** |
| 500 | 500 |
* Sends a HELO/EHLO command. |
| 501 |
* @access private
|
|
| 502 |
* @return bool
|
|
| 501 |
* @access private |
|
| 502 |
* @return bool |
|
| 503 | 503 |
*/ |
| 504 | 504 |
function SendHello($hello, $host) {
|
| 505 | 505 |
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); |
| ... | ... | |
| 540 | 540 |
* |
| 541 | 541 |
* SMTP CODE SUCCESS: 211,214 |
| 542 | 542 |
* SMTP CODE ERROR : 500,501,502,504,421 |
| 543 |
* @access public
|
|
| 544 |
* @return string
|
|
| 543 |
* @access public |
|
| 544 |
* @return string |
|
| 545 | 545 |
*/ |
| 546 | 546 |
function Help($keyword="") {
|
| 547 | 547 |
$this->error = null; # to avoid confusion |
| ... | ... | |
| 592 | 592 |
* SMTP CODE SUCCESS: 250 |
| 593 | 593 |
* SMTP CODE SUCCESS: 552,451,452 |
| 594 | 594 |
* SMTP CODE SUCCESS: 500,501,421 |
| 595 |
* @access public
|
|
| 596 |
* @return bool
|
|
| 595 |
* @access public |
|
| 596 |
* @return bool |
|
| 597 | 597 |
*/ |
| 598 | 598 |
function Mail($from) {
|
| 599 | 599 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 635 | 635 |
* |
| 636 | 636 |
* SMTP CODE SUCCESS: 250 |
| 637 | 637 |
* SMTP CODE ERROR : 500, 421 |
| 638 |
* @access public
|
|
| 639 |
* @return bool
|
|
| 638 |
* @access public |
|
| 639 |
* @return bool |
|
| 640 | 640 |
*/ |
| 641 | 641 |
function Noop() {
|
| 642 | 642 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 678 | 678 |
* |
| 679 | 679 |
* SMTP CODE SUCCESS: 221 |
| 680 | 680 |
* SMTP CODE ERROR : 500 |
| 681 |
* @access public
|
|
| 682 |
* @return bool
|
|
| 681 |
* @access public |
|
| 682 |
* @return bool |
|
| 683 | 683 |
*/ |
| 684 | 684 |
function Quit($close_on_error=true) {
|
| 685 | 685 |
$this->error = null; # so there is no confusion |
| ... | ... | |
| 732 | 732 |
* SMTP CODE SUCCESS: 250,251 |
| 733 | 733 |
* SMTP CODE FAILURE: 550,551,552,553,450,451,452 |
| 734 | 734 |
* SMTP CODE ERROR : 500,501,503,421 |
| 735 |
* @access public
|
|
| 736 |
* @return bool
|
|
| 735 |
* @access public |
|
| 736 |
* @return bool |
|
| 737 | 737 |
*/ |
| 738 | 738 |
function Recipient($to) {
|
| 739 | 739 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 776 | 776 |
* |
| 777 | 777 |
* SMTP CODE SUCCESS: 250 |
| 778 | 778 |
* SMTP CODE ERROR : 500,501,504,421 |
| 779 |
* @access public
|
|
| 780 |
* @return bool
|
|
| 779 |
* @access public |
|
| 780 |
* @return bool |
|
| 781 | 781 |
*/ |
| 782 | 782 |
function Reset() {
|
| 783 | 783 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 825 | 825 |
* SMTP CODE SUCCESS: 250 |
| 826 | 826 |
* SMTP CODE SUCCESS: 552,451,452 |
| 827 | 827 |
* SMTP CODE SUCCESS: 500,501,502,421 |
| 828 |
* @access public
|
|
| 829 |
* @return bool
|
|
| 828 |
* @access public |
|
| 829 |
* @return bool |
|
| 830 | 830 |
*/ |
| 831 | 831 |
function Send($from) {
|
| 832 | 832 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 873 | 873 |
* SMTP CODE SUCCESS: 250 |
| 874 | 874 |
* SMTP CODE SUCCESS: 552,451,452 |
| 875 | 875 |
* SMTP CODE SUCCESS: 500,501,502,421 |
| 876 |
* @access public
|
|
| 877 |
* @return bool
|
|
| 876 |
* @access public |
|
| 877 |
* @return bool |
|
| 878 | 878 |
*/ |
| 879 | 879 |
function SendAndMail($from) {
|
| 880 | 880 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 921 | 921 |
* SMTP CODE SUCCESS: 250 |
| 922 | 922 |
* SMTP CODE SUCCESS: 552,451,452 |
| 923 | 923 |
* SMTP CODE SUCCESS: 500,501,502,421 |
| 924 |
* @access public
|
|
| 925 |
* @return bool
|
|
| 924 |
* @access public |
|
| 925 |
* @return bool |
|
| 926 | 926 |
*/ |
| 927 | 927 |
function SendOrMail($from) {
|
| 928 | 928 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 966 | 966 |
* SMTP CODE SUCCESS: 250 |
| 967 | 967 |
* SMTP CODE FAILURE: 502 |
| 968 | 968 |
* SMTP CODE ERROR : 500, 503 |
| 969 |
* @access public
|
|
| 970 |
* @return bool
|
|
| 969 |
* @access public |
|
| 970 |
* @return bool |
|
| 971 | 971 |
*/ |
| 972 | 972 |
function Turn() {
|
| 973 | 973 |
$this->error = array("error" => "This method, TURN, of the SMTP ".
|
| ... | ... | |
| 988 | 988 |
* SMTP CODE SUCCESS: 250,251 |
| 989 | 989 |
* SMTP CODE FAILURE: 550,551,553 |
| 990 | 990 |
* SMTP CODE ERROR : 500,501,502,421 |
| 991 |
* @access public
|
|
| 992 |
* @return int
|
|
| 991 |
* @access public |
|
| 992 |
* @return int |
|
| 993 | 993 |
*/ |
| 994 | 994 |
function Verify($name) {
|
| 995 | 995 |
$this->error = null; # so no confusion is caused |
| ... | ... | |
| 1033 | 1033 |
* With SMTP we can tell if we have more lines to read if the |
| 1034 | 1034 |
* 4th character is '-' symbol. If it is a space then we don't |
| 1035 | 1035 |
* need to read anything else. |
| 1036 |
* @access private
|
|
| 1037 |
* @return string
|
|
| 1036 |
* @access private |
|
| 1037 |
* @return string |
|
| 1038 | 1038 |
*/ |
| 1039 | 1039 |
function get_lines() {
|
| 1040 | 1040 |
$data = ""; |
Also available in: Unified diff
fixed headerinfos