/    Sign up×
Community /Pin to ProfileBookmark

phpMailer SMTP Problem

Hi I am trying to use phpmailer smtp for some webform but can’t get it to work. I use the below script and didn’t get any error message but the emails were never received. The whole website is encrypted with SSL. Is there anything addition needed? Any help will be appreciated. thx.

[code=php]
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = ‘mail.domain.com’;
$mail->Port = 25;
$mail->Username = ‘[email protected]’;
$mail->Password = ‘Password’;

$mail->SetFrom($email, $firstname . ” ” . $lastname);
$mail->AddAddress($contact);
$mail->Subject = $subject;
$mail->MsgHTML($message);

$mail->WordWrap = 50;
$mail->Send();
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmMar 13.2014 — Do you have error checking turned on?
Copy linkTweet thisAlerts:
@NogDogMar 13.2014 — Check to see if PHPMailer has anything to tell you. Instead of just calling send(), actually check to see if it worked:
[code=php]
if($mail->Send() == false) {
error_log("PHPMailer::Send() failed:".PHP_EOL.$mail->ErrorInfo);
}
[/code]

(Or die() instead of error_log() if you prefer for initial debugging.)
×

Success!

Help @phpnewbie08 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...