/** * Personalities / Custom FROM addresses * * @return bool Success or not. * @param string $action An action to perform: [set this address to] default, delete, reply_sent, reply_default, edit, edit_google, send_verify, verify_code * @param string $email * @param string $name * @param string $reply_to * @param integer $code Verification code for an added custom from address * @desc Custom From Address features * @author Neerav * @since 25 Feb 2006 */ function customFrom($action, $email, $name = "", $reply_to = "", $code = "") { if ($this->isConnected()) { $url = "&ik=&view=up"; $refer = "&view=pr&pnl=g" . $this->proxy_defeat(); $method = 'post'; switch ($action) { case "default": // set this as default From email address $postdata = "act=mcf_" . urlencode($email); $postdata .= "&at=" . $this->at_value(); break; case "delete": // remove this From email address $postdata = "act=dcf_" . urlencode($email); $postdata .= "&at=" . $this->at_value(); break; case "reply_sent": // set reply address to that which the message was sent to $postdata = "act=crf_1"; $postdata .= "&at=" . $this->at_value(); $postdata .= "&search="; break; case "reply_default": // set reply address to the default From $postdata = "act=crf_0"; $postdata .= "&at=" . $this->at_value(); $postdata .= "&search="; break; case "edit": // update the details of an existing From address $postdata = "cfrp=1&cfe=1&cfn=" . urlencode($name) . "&cfrt=" . urlencode($reply_to); $url = "&view=cf&cfe=true&cfa=" . urlencode($email) . $this->proxy_defeat(); $refer = $url; break; case "edit_google": // update the details of the Google Account info $postdata['cfrp'] = 1; $postdata['cfe'] = 1; $postdata['cfgnr'] = $name != "" ? 1 : 0; $postdata['cfgn'] = $name; $postdata['cfrt'] = $reply_to; $url = "&view=cf&cfe=true&cfa=" . urlencode($email) . $this->proxy_defeat(); $refer = $url; break; /* case "add_pre": // Gmail's preparation step for adding a new From. Not required. Directly use "send_verify" */ /* $postdata = ""; */ /* $url = "&view=cf".$this->proxy_defeat(); */ /* $method = 'get'; */ /* break; */ /* case "add": // Gmail's first step in adding a new From. Not required. Directly use "send_verify" */ /* $postdata = array(); */ /* $postdata['cfrp'] = 1; */ /* $postdata['cfn'] = $name; */ /* $postdata['cfa'] = $email; */ /* $postdata['cfrt'] = $reply_to; */ /* $url = "&view=cf"; */ /* $refer = $url; */ /* break; */ /* case "add_pre": // Gmail's preparation step for adding a new From. Not required. Directly use "send_verify" */ /* $postdata = ""; */ /* $url = "&view=cf".$this->proxy_defeat(); */ /* $method = 'get'; */ /* break; */ /* case "add": // Gmail's first step in adding a new From. Not required. Directly use "send_verify" */ /* $postdata = array(); */ /* $postdata['cfrp'] = 1; */ /* $postdata['cfn'] = $name; */ /* $postdata['cfa'] = $email; */ /* $postdata['cfrt'] = $reply_to; */ /* $url = "&view=cf"; */ /* $refer = $url; */ /* break; */ case "send_verify": // send the verification email to the From address // also used to directly add a new From address $postdata = array(); $postdata['cfrp'] = 2; $postdata['cfn'] = $name; $postdata['cfa'] = $email; $postdata['cfrt'] = $reply_to; $postdata['submit'] = "Send Verification"; $url = "&view=cf"; $refer = $url; break; case "verify_code": // enter verification code to verify previously added From address $postdata = array(); $postdata['cfrp'] = 3; $postdata['cfrs'] = "false"; $postdata['cfn'] = $name; $postdata['cfa'] = $email; $postdata['cfrt'] = $reply_to; $postdata['cfvc'] = $code; $url = "&view=cf"; $refer = $url; break; default: array_unshift($this->return_status, array("action" => "custom from: {$action}", "status" => "failed", "message" => "libgmailer: Invalid action")); return 0; } $this->gmail_data = GMailer::execute_curl($this->GM_LNK_GMAIL . "?" . $url, $this->GM_LNK_GMAIL . "?" . $refer, $method, $postdata); GMailer::parse_gmail_response($this->gmail_data); if ($action == "send_verify" or $action == "add" or $action == "add_pre" or $action == "verify_code") { $status = 1; } else { $status = isset($this->raw["cfs"]) ? 1 : 0; } /* $status = (isset($this->raw["ar"][1])) ? $this->raw["ar"][1] : 0; */ $message = isset($this->raw["ar"][2]) ? $this->raw["ar"][2] : ""; $a = array("action" => "custom from: {$action}", "status" => $status ? "success" : "failed", "message" => $message); array_unshift($this->return_status, $a); return $status; } else { $a = array("action" => "custom from", "status" => "failed", "message" => "libgmailer: not connected"); array_unshift($this->return_status, $a); return false; } }
/** * Personalities / Custom FROM addresses * * @return bool Success or not. * @param string $action An action to perform: [set this address to] default, delete, reply_sent, reply_default, edit, edit_google, send_verify, verify_code * @param string $email * @param string $name * @param string $reply_to * @param integer $code Verification code for an added custom from address * @desc Custom From Address features * @author Neerav * @since 25 Feb 2006 */ function customFrom($action, $email, $name = "", $reply_to = "", $code = "") { if ($this->isConnected()) { $url = "&ik=&view=up"; $refer = "&view=pr&pnl=g" . $this->proxy_defeat(); $method = 'post'; switch ($action) { case "default": $postdata = "act=mcf_" . urlencode($email); $postdata .= "&at=" . $this->at_value(); break; case "delete": $postdata = "act=dcf_" . urlencode($email); $postdata .= "&at=" . $this->at_value(); break; case "reply_sent": $postdata = "act=crf_1"; $postdata .= "&at=" . $this->at_value(); $postdata .= "&search="; break; case "reply_default": $postdata = "act=crf_0"; $postdata .= "&at=" . $this->at_value(); $postdata .= "&search="; break; case "edit": $postdata = "cfrp=1&cfe=1&cfn=" . urlencode($name) . "&cfrt=" . urlencode($reply_to); $url = "&view=cf&cfe=true&cfa=" . urlencode($email) . $this->proxy_defeat(); $refer = $url; break; case "edit_google": $postdata['cfrp'] = 1; $postdata['cfe'] = 1; $postdata['cfgnr'] = $name != "" ? 1 : 0; $postdata['cfgn'] = $name; $postdata['cfrt'] = $reply_to; $url = "&view=cf&cfe=true&cfa=" . urlencode($email) . $this->proxy_defeat(); $refer = $url; break; /* case "add_pre": */ /* $postdata = ""; */ /* $url = "&view=cf".$this->proxy_defeat(); */ /* $method = 'get'; */ /* break; */ /* case "add": */ /* $postdata = array(); */ /* $postdata['cfrp'] = 1; */ /* $postdata['cfn'] = $name; */ /* $postdata['cfa'] = $email; */ /* $postdata['cfrt'] = $reply_to; */ /* $url = "&view=cf"; */ /* $refer = $url; */ /* break; */ /* case "add_pre": */ /* $postdata = ""; */ /* $url = "&view=cf".$this->proxy_defeat(); */ /* $method = 'get'; */ /* break; */ /* case "add": */ /* $postdata = array(); */ /* $postdata['cfrp'] = 1; */ /* $postdata['cfn'] = $name; */ /* $postdata['cfa'] = $email; */ /* $postdata['cfrt'] = $reply_to; */ /* $url = "&view=cf"; */ /* $refer = $url; */ /* break; */ case "send_verify": $postdata = array(); $postdata['cfrp'] = 2; $postdata['cfn'] = $name; $postdata['cfa'] = $email; $postdata['cfrt'] = $reply_to; $postdata['submit'] = "Send Verification"; $url = "&view=cf"; $refer = $url; break; case "verify_code": $postdata = array(); $postdata['cfrp'] = 3; $postdata['cfrs'] = "false"; $postdata['cfn'] = $name; $postdata['cfa'] = $email; $postdata['cfrt'] = $reply_to; $postdata['cfvc'] = $code; $url = "&view=cf"; $refer = $url; break; default: array_unshift($this->return_status, array("action" => "custom from: {$action}", "status" => "failed", "message" => "libgmailer: Invalid action")); return 0; } $this->gmail_data = GMailer::execute_curl(GM_LNK_GMAIL . "?" . $url, GM_LNK_GMAIL . "?" . $refer, $method, $postdata); GMailer::parse_gmail_response($this->gmail_data); if ($action == "send_verify" or $action == "add" or $action == "add_pre" or $action == "verify_code") { $status = 1; } else { $status = isset($this->raw["cfs"]) ? 1 : 0; } /* $status = (isset($this->raw["ar"][1])) ? $this->raw["ar"][1] : 0; */ $message = isset($this->raw["ar"][2]) ? $this->raw["ar"][2] : ""; $a = array("action" => "custom from: {$action}", "status" => $status ? "success" : "failed", "message" => $message); array_unshift($this->return_status, $a); return $status; } else { $a = array("action" => "custom from", "status" => "failed", "message" => "libgmailer: not connected"); array_unshift($this->return_status, $a); return false; } }