|
|
Cannot send emails
Hi,
I have problems sending mails. The messages are as follows:
PHP Warning: Connection refused in /usr/share/php/PEAR.php on line 873
PHP Warning: Failed to connect socket: Connection refused in /usr/share/php/PEAR.php on line 873
I used the following code:
<?php
require_once 'Mail.php';
require_once 'PEAR.php';
define('MYCLASS_ERROR_CODE', 1);
PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
$from_name = 'Marco';
$to_name = 'Recipient';
$subject = 'Testmail';
$mailmsg = 'dummy content';
$From = "From: ".$from_name." <myaddress@domain.net>";
$To = "To: ".$to_name." <recipientaddress@domain.net>";
$recipients = "recipientaddress@domain.net";
$headers["From"] = $From;
$headers["To"] = $To;
$headers["Subject"] = $subject;
$headers["Reply-To"] = "myaddress@domain.net";
$headers["Content-Type"] = "text/plain; charset=UTF-8";
$headers["Return-path"] = "myaddress@domain.net";
$smtpinfo["host"] = "server.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "myusername";
$smtpinfo["password"] = "verysecret";
$mail_object =& Mail::factory("smtp", $smtpinfo);
$mail_object->send($recipients, $headers, $mailmsg);
?>
When I use the same host, port, username and password in my mail program I can
send mails. What is wrong with this setup?
Marco
|
|
0
|
|
|
|
Reply
|
Marco
|
3/24/2011 5:39:46 PM |
|
I tried
telnet server.com 25
and I got:
telnet: Unable to connect to remote host: Connection refused
This should work, if I'm not mistaken, right? I have no clue, where the
problem could be. Why is the connection refused?
Marco
|
|
0
|
|
|
|
Reply
|
Marco
|
3/24/2011 5:53:28 PM
|
|
Sorry for talking to myself. Here's the solution:
1) Try the correct port: 465
2) Use SSL: $smtpinfo["host"] = "ssl://server.com";
3) Happy Mailing :)
Thanks for listening.
Marco
|
|
0
|
|
|
|
Reply
|
Marco
|
3/24/2011 6:06:20 PM
|
|
|
2 Replies
192 Views
(page loaded in 0.182 seconds)
Similiar Articles: Cannot send e-mail to homail account - comp.mail.miscIs there a way to locate old emails I sent years ago? - comp.mail ... Cannot send e-mail to homail account - comp.mail.misc Is there a way to locate old emails I sent ... sending mail through Outlook - comp.soft-sys.matlabCan't send email through VPN - comp.dcom.sys.cisco sending mail through Outlook - comp.soft-sys.matlab Can't send email through VPN - comp.dcom.sys.cisco Cannot send mail ... Sending SMTP email with server that requires authentication - comp ...SMTP authorization which many ISPs now require to ... SMTP server offers SMTP AUTH authentication ... IMAP server. What I cannot do, however, is send email. Can't send email through VPN - comp.dcom.sys.ciscoApparently it's possible, as my newsreader (Xnews) and Mozilla Mail can send email through the VPN OK, but Pegasus cannot. Pegasus never even tries to send the ... Is there a way to locate old emails I sent years ago? - comp.mail ...Cannot send e-mail to homail account - comp.mail.misc Is there a way to locate old emails I sent years ago? - comp.mail ... If you see this text, it means that your E-mail ... submit form, validate form, set cookie, send email, download file ...... answer to your question is No... however... that does not mean that you cannot do ... Form, Validate Form, Set Cookie, Send Email, Download File Jquery :: Auto-send Email On ... Send to mail recipient, in Word, is grayed out. - comp.sys.mac ...I cannot figure out how to enable it. Word help is near useless. Jeff. ... QMF for Windows - Procedure to Send Email using REXX - comp.lang ... address cmd 'BLAT ... Sending many files attachment with mailx - comp.unix.solaris ...... send/${file}.uuencoded >> /tmp/mail.msg > done > mailx -s "Files to send" email ... I replaced mail with mailx, then it ... I cannot seem to send multiple files using AIX. How to recover a deleted mailbox in Mail. - comp.sys.mac.apps ...If you have Mail configured to leave email on your network's mail server, then ... Cannot send e-mail to homail account - comp.mail.misc Hi, Whenever I try to send e-mail ... Argosoft Mail Server Error - comp.mail.miscnope i cannot connect. so it means that port 25 is blocked. So what are my options here? Also when i send an email to this email, it ... Also when i send an email to this ... Cannot Send Email - help.expedient.com - Customer Support CenterCannot Send Email. If you are able to receive messages but cannot send messages: Verify your email settings are correct (the SMTP server and email address must be ... Cannot send email messages from email programCannot send emails but can receive? Get detailed help and solution to your problem on this page. 7/11/2012 1:59:47 PM
|
|
|
|
|
|
|
|
|