Ask PHP to send mail, how to pass the proxy server this Gateway

Source: Internet
Author: User
I wrote a mail-sending feature that can be used at home.
But because the company is the intranet, the Internet is required to set up a proxy server, how to send through the proxy server?
It's best to give the code, thank you.
Certain knot paste!
Here is my current code.
Class JMail
{
Public $Username; Post Office User name
Public $Password; Password
Public $FormName; Sender's name
Public $From; Sender Address
Public $Addrecipient; Recipient address
Public $Ttile; Message header
Public $Content; Message content
Public $Smtp; Mail server

function Send () {
$Jmail = new COM ("Jmail.message"); Instantiate a JMail object
$Jmail->silent=true; Set to True if JMail does not prompt for errors only returns true and False
$Jmail->logging = false; Whether to turn on the log
$Jmail->charset = "GB2312"; Set string encoding
$Jmail->contenttype = "text/html"; The format of the message is in HTML format
$Jmail->mailserverusername = $this->username; Outgoing Mailbox User name
$Jmail->mailserverpassword = $this->password; e-mail Password
$Jmail->fromname = $this->fromname; Sender's name
$Jmail->from = $this->from; Sender Address
$Jmail->addrecipient ($this->addrecipient); Recipient address
$Jmail->subject = $this->title;//email title
$Jmail->body = $this->content; Email text
$JmailError = $Jmail->send ($this->smtp); SMTP server
if ($JmailError) {//To determine if the message was sent successfully
return true;
}else{
return false;
}
}
}

$jmail = new JMail ();
$jmail->username = "My Mailbox";
$jmail->password = "my password";
$jmail->fromname = "Test";
$jmail->from = "My mailbox name";
$jmail->addrecipient = "Address";
$jmail->title = "TTT";
$jmail->content = "CCCC";
$jmail->SMTP = "Mailing server address";
if ($jmail->send ()) {
echo "Success Oh!";
}else{
echo "Failed Oh!";
}
?>


Reply to discussion (solution)

Use SMTP to send it. You can use the mailbox on QQ!

The question is how does the intranet IP be sent to the SMTP server? If can call to the external network IP, I this can be sent.

Does your proxy server have a mail agent open?

That is true
Our computer here is the intranet IP, and then through the external network IP to access the external network, and then the mail server is in the external network.
So I understand that should be even Sisu network IP to send mail success. I don't know if I can make you understand.

Do not know my understanding there is no problem, please give us a lot of advice ... I will study hard.

Is it blocked when it's sent?

That is true
Our computer here is the intranet IP, and then through the external network IP to access the external network, and then the mail server is in the external network.
So I understand that should be even Sisu network IP to send mail success. I don't know if I can make you understand. If the intranet is through the router Sisu network, then you can directly use
If it is through the proxy server Sisu network, you need to turn on the Proxy Server mail agent function (by default, it is turned off)

Okay, thanks, I'll check it out.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.