Jump to content

same email service, two email account, one work, one doesn't using phpmailer


Recommended Posts

Hi all,

I tried sending email using phpmailer.

It works for one account and it does not work for another.

For example, if I use [email protected] as sender to send out mail it works.

But if use [email protected] as the sender, it does not send out the mail.

To confirm the set up and password is correct, I tried sending the email from the 126 account instead of from the PHP program, it works.

The smtp server I used is smtp.126.com. Is it possible that one account is attached to smtp.126.com and another account is attached to another smtp server, thus if I use smtp.126.com. it works for one account and it does not work for another. Is this possible??

Any one any hints??

Thanks.

Why do you not just use mail(); ?

Because mail() does not support SMTP Authentication which is necessary to send through an ISP's mail server.

 

The phpmailer class should return an error from the mail server if the smtp settings are not correct. What is your code?

The following are my codes:

I have defined this as a function and it is called by a main program.  The problem : if I use the account abc.126.com, it works, if I used another one, it does not. The user id and password of another account are correct (I tested that). So I do not know why.  By the way, I put the error_reporting(E_ALL), I am not getting any error message.

 

code --

 

function smtp_mail ($subj,$body,$email,$name) {

$mail    = new PHPMailer(); 

$mail->IsSMTP(); 

              // send via SMTP 

$mail->Host  = "smtp.126.com";  // SMTP servers 

$mail->SMTPAuth = true;          // turn on SMTP authentication 

$mail->Username = "abc";    // SMTP username   

$mail->Password = "abc254494";          // SMTP password 

$mail->From  = "[email protected]";        // sender email address

$mail->FromName =  "cs@abc";    // sender name

$mail->CharSet  = "GB2312";              // !

$mail->Encoding = "base64";

$mail->AddAddress($email,$name);    // recipient email and name

$mail->IsHTML(true);    // send as HTML           

$mail->Subject  = $subj; //

$mail->Body = $body;//

$mail->AltBody ="text/html"; 

$mail->Send();

}

 

-- end code

 

Thanks.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.