/    Sign up×
Community /Pin to ProfileBookmark

Problem with PHP Mail, not sure if it is installed correctly

Hi all,

I installed PEAR yesterday and I think that went ok although although there is only 1 reference to pear in phpinfo which is

include_path has a local value of .;c:wwwphppear

I have downloaded the mail package and I have it under the site root

php root (dir)
[INDENT]PEAR (dir)
[INDENT]Mail.php
Mail (dir)[INDENT]mail.php
null.php
RFC822.php
sendmail.php
smtp.php[/INDENT][/INDENT][/INDENT]

Is this the correct setup? When I run the example script

[code=php]require_once “Mail.php”;

$from = “John Evans<[email protected]>”;
$to = “John Evans<[email protected]>”;
$subject = “Hi!”;
$body = “Hi,nnHow are you?”;

$host = “auth.smtp.1and1.co.uk”;
$username = “john.evans:forcesresources.co.uk”;
$password = “********”;

$headers = array (‘From’ => $from,
‘To’ => $to,
‘Subject’ => $subject);
$smtp = Mail::factory(‘smtp’,
array (‘host’ => $host,
‘auth’ => true,
‘username’ => $username,
‘password’ => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo(“<p>” . $mail->getMessage() . “</p>”);
} else {
echo(“<p>Message successfully sent!</p>”);
}
[/code]

I get the following

[code=html]Strict Standards: Assigning the return value of new by reference is deprecated in C:wwwphpPEARMail.php on line 154

Strict Standards: Non-static method Mail::factory() should not be called statically in C:wwwwebsiteadmintest.php on line 20

Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in C:wwwphpPEARMailsmtp.php on line 206

Warning: include_once() [function.include]: Failed opening ‘Net/SMTP.php’ for inclusion (include_path=’.;c:wwwphppear’) in C:wwwphpPEARMailsmtp.php on line 206

Fatal error: Class ‘Net_SMTP’ not found in C:wwwphpPEARMailsmtp.php on line 210[/code]

Any help much appreciated as I am desperate to get this problem sorted.

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiApr 22.2009 — Yes it is correct, and aside from the strict warnings which are pretty self explanatory, your problem is that you don't have the Net_SMTP package installed.
Copy linkTweet thisAlerts:
@postedoverseasauthorApr 22.2009 — Thanks, that one half worked.

I have downloaded that one but now I fails as it can't find Net/Socket.php
[code=html]Warning: require_once(Net/Socket.php) [function.require-once]: failed to open stream: No such file or directory in C:wwwphpPEARNetSMTP.php on line 24

Fatal error: require_once() [function.require]: Failed opening required 'Net/Socket.php' (include_path='.;c:wwwphppear') in C:wwwphpPEARNetSMTP.php on line 24[/code]


Is this on another package?

Thanks again for your help.
Copy linkTweet thisAlerts:
@postedoverseasauthorApr 22.2009 — Please ignore my last post. I now have the correct packages but now I face an authentication error that I cannot as yet get around.
[code=html]authentication failure [SMTP: STARTTLS failed (code: 220, response: Go ahead)][/code]

I think it is to do with the auth.smtp.1and1.co.uk server.

I will continue to look into it but any help would be much appreciated.
Copy linkTweet thisAlerts:
@MindzaiApr 22.2009 — That would be the Net_Socket package :p
Copy linkTweet thisAlerts:
@postedoverseasauthorApr 22.2009 — Hi Mindzai

It looks like our posts crossed, please see a few posts up.

Thanks again.
Copy linkTweet thisAlerts:
@MindzaiApr 22.2009 — Not sure how 1&1 have things set up, but you're not the only one to have problems with them & smtp. You might want to try using sendmail instead of smtp. See this documentation for more info, or maybe 1&1 support will be able to help (lol!).
Copy linkTweet thisAlerts:
@postedoverseasauthorApr 25.2009 — Well, I still cannot get the mail or php PEAR Mail functions to work from my localhost and when I contacted 1&1 they pointed my to a page that explained the mail function which doesn't help as I know it works on the remote files just not on the localhost.

I have found that PHPMailer works fine on the localhost and so I am going to use this instead.

Thanks anyway
×

Success!

Help @postedoverseas 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.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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