fsockopen returned Error Number 0 and Error String ''

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
JohnGalt
Forum Newbie
Posts: 2
Joined: Sat Aug 16, 2008 1:10 am

fsockopen returned Error Number 0 and Error String ''

Post by JohnGalt »

Hi there,

I am sorry to ask something as probably simple as this but I couldn't find a solution elsewhere.

I have just installed the latest version and try to run the smoketests. Here is the result on the basic test.
Error: The SMTP connection failed to start [ssl://smtp.swiftmailer.org:25]: fsockopen returned Error Number 0 and Error String ''
Log Information

++ Log level changed to 4
++ Forcing ESMTP mode. HELO is EHLO.
++ Forcing ESMTP mode. HELO is EHLO.
++ Trying to connect...
++ Trying to connect to SMTP server at 'ssl://smtp.swiftmailer.org:25
!! The SMTP connection failed to start [ssl://smtp.swiftmailer.org:25]: fsockopen returned Error Number 0 and Error String ''
My host says that their server is set up correctly but something must bewrong somewhere. The question is: Where?

Do you know?

I appreciate any help!

Thanks and best regards,
John
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: fsockopen returned Error Number 0 and Error String ''

Post by ghurtado »

Why are you trying to connect to the swiftmailer's website SMTP server? You should replace that with the address to your own mail server.
JohnGalt
Forum Newbie
Posts: 2
Joined: Sat Aug 16, 2008 1:10 am

Re: fsockopen returned Error Number 0 and Error String ''

Post by JohnGalt »

Dear Garcia,

the answer is very simple: I don't have a clue of what I am doing! :banghead: But I try to learn! :)

It's only NOW that I know that I can use the SMTP that is installed on my server by just placing "localhost" in FQDN. That is only possible beacuse YOU answered my posting! So thank you very much indeed! :D

Here is a part of the TestConfiguration.php that works with my server (I hopes it might help some other beginner):
<?php

define("TEST_CONFIG_PATH", dirname(__FILE__));
echo (TEST_CONFIG_PATH);
define("DEFAULT_WRITABLE_PATH", TEST_CONFIG_PATH . "/tmp");
define("DEFAULT_LIBRARY_PATH", TEST_CONFIG_PATH . "/../lib");
define("FILES_PATH", TEST_CONFIG_PATH . "/files");

/**
* Adjust the values contained inside this class in order to run the tests
* NOTE: SimpleTest is NOT provided with Swift. You must download this from SouceForge yourself.
* Paths given should be either relative to the "tests/units" directory or absolute.
* @package Swift_Tests
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class TestConfiguration
{
/**
* Somewhere to write to when testing disk cache
*/
const WRITABLE_PATH = DEFAULT_WRITABLE_PATH;
/**
* The location of SimpleTest (Unit Test Tool)
*/
/* const SIMPLETEST_PATH = "/Users/d11wtq/PHPLibs/simpletest"; */
const SIMPLETEST_PATH = "/simpletest";
/**
* The location of the Swift library directory
*/
const SWIFT_LIBRARY_PATH = DEFAULT_LIBRARY_PATH;
/**
* The location of some files used in testing.
*/
const FILES_PATH = FILES_PATH;

/*
* EVERYTHING BELOW IS FOR SMOKE TESTING ONLY
*/

/**
* The connection type to use in testing
* "smtp", "sendmail" or "nativemail"
*/
const CONNECTION_TYPE = "smtp";
/**
* An address to send emails from
*/
const FROM_ADDRESS = "FromSomeone@yourDomain.com";
/**
* The name of the sender
*/
const FROM_NAME = "Your name - from";
/**
* An address to send emails to
*/
const TO_ADDRESS = "ToSomeone@SomeonesDomain.com";
/**
* The name of the recipient
*/
const TO_NAME = "The recipiants name - to";

/*
* SMTP SETTINGS - IF APPLICABLE
*/

/**
* The FQDN of the host
*/
:arrow: const SMTP_HOST = "localhost";
/**
* The remote port of the SMTP server
*/
const SMTP_PORT = 25;
/**
* Encryption to use if any
* "ssl", "tls" or false
*/
const SMTP_ENCRYPTION = false;
/**
* A username for SMTP, if you need to authenticate before sending an email
*/
const SMTP_USER = "YourUserNameForTheEmailAccountYouSendBy";
/**
* Password for SMTP, if you need to authenticate before sending an email
*/
const SMTP_PASS = "YourPasswordForTheEmailAccountYouSendBy";

/*
* SENDMAIL BINARY SETTINGS - IF APPLICABLE
*/

/**
* The path to sendmail, including the -bs options
*/
const SENDMAIL_PATH = "/usr/sbin/sendmail -bs";
}
And very amazingly everything is fine with these settings.

Thanks again for your help, Garcia!

Kind regards,
John
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: fsockopen returned Error Number 0 and Error String ''

Post by ghurtado »

You are most welcome! I am glad you got it to work.
Post Reply