How can I use the proxy server to send emails through PHP?

Source: Internet
Author: User
For PHP mail, how can I use the proxy server to send mail.
However, because the company uses the intranet, proxy servers need to be configured for accessing the internet. how can I send data through a proxy server?
It is best to provide code. thank you.
Paste it!
The following is my current code.
Class Jmail
{
Public $ Username; // Post Office Username
Public $ Password; // Password
Public $ FormName; // sender's name
Public $ From; // sender address
Public $ Addrecipient; // recipient address
Public $ Ttile; // mail title
Public $ Content; // email Content
Public $ Smtp; // email server

Function Send (){
$ Jmail = new com ("Jmail. Message"); // instantiate a Jmail object
$ Jmail-> SiLent = true; // if it is set to True, Jmail will not prompt the error and only return True and False.
$ Jmail-> LogGing = false; // whether to enable LogGing
$ Jmail-> CharSet = "GB2312"; // sets the string encoding.
$ Jmail-> ContentType = "Text/html"; // The email format is HTML.
$ Jmail-> MailServerUsername = $ this-> Username; // The user name of the mailbox.
$ Jmail-> MailServerPassword = $ this-> Password; // The sender's 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 Body
$ JmailError = $ Jmail-> Send ($ this-> Smtp); // Smtp server
If ($ JmailError) {// determines whether the email is successfully sent.
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 = "mail server address ";
If ($ jmail-> Send ()){
Echo "successful! ";
} Else {
Echo "failed! ";
}
?>


Reply to discussion (solution)

Use smtp to send messages. You can use qq's mailbox!

How can I send an intranet IP address to the SMTP server? If you can call an Internet IP address, I can send it.

Is email proxy enabled on your proxy server?

Yes.
Our computers here are all intranet IP addresses, and then we need to access the Internet through the Internet IP address; then the mail server is mounted on the Internet.
Therefore, I understand that it is necessary to connect to an Internet IP address to successfully send the email. I don't know if I can make it clear.

I don't know if I have any questions. please kindly advise... I will study hard.

Will it be blocked during sending?

Yes.
Our computers here are all intranet IP addresses, and then we need to access the Internet through the Internet IP address; then the mail server is mounted on the Internet.
Therefore, I understand that it is necessary to connect to an Internet IP address to successfully send the email. I don't know if I can make it clear. If the intranet is through the Internet, you can directly use
If the proxy server is connected to the Internet, you need to activate the proxy server's mail proxy function (which is disabled by default)

Okay. thank you. let me check it.

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.