Page 1 of 1

GMail and PHP Swift , PHP Mailler

Posted: Wed May 30, 2007 10:02 pm
by vetola
i config all this in Swift and PHPMailer

- connection : smtp
-is smtp : true
- smtphost : smtp.gmail.com
- port : 25 , 465 or 578
- auth : true
- smtp type , tls and ssl
- user : aaaaa or aaaaa@gmail.com
- pwd : aaaaa

i met alot of error when i try such as STARTTLS first , max time out , fsock open , recipients failed ...

Posted: Thu May 31, 2007 7:54 am
by Chris Corbyn
As per my reply to your email, you'll need to tell us what errors you're getting and I'll bet my left sock that your PHP version does not have OpenSSL compiled into it. If you're on windows there's a .dll for it that you need to uncomment.

Posted: Thu May 31, 2007 12:00 pm
by polpol
Hi there,

My knowledge of all this is basic at best, but i've been having the same problem as vetola and, after hours of research, came to the conclusion there was no openssl support on my server. Running phpinfo confirmed this (i think, couldn't find mention of openssl).

So, forgive my ignorance, but is this pretty much the end of it then; no openssl no luck?

Also, how reasonable is it of me to push my provider to support it? I mean, is it a big deal getting them to do it, something i should expect to pay for, or is it quite a simple process?


Thanks for your time.

Posted: Thu May 31, 2007 2:25 pm
by Chris Corbyn
polpol wrote:Hi there,

My knowledge of all this is basic at best, but i've been having the same problem as vetola and, after hours of research, came to the conclusion there was no openssl support on my server. Running phpinfo confirmed this (i think, couldn't find mention of openssl).

So, forgive my ignorance, but is this pretty much the end of it then; no openssl no luck?

Also, how reasonable is it of me to push my provider to support it? I mean, is it a big deal getting them to do it, something i should expect to pay for, or is it quite a simple process?


Thanks for your time.
You should push you provider to support it. OpenSSL is needed for anything which uses the ssl:// and tls:// wrappers.

I reasearched for a long time for ways to support STARTTLS (connect on port 25 unencrypted and then negotiate TLS from within that connection). It's just not viable with PHP since I'd have to write the TLS handling code myself.

Is it a PHP4 or 5 server? What errors do you get? :)

Posted: Thu May 31, 2007 8:32 pm
by vetola
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


The OpenSSL and its extension dll setup ready. i use IIS . i try to setup php4 and also php5.
when i try to test i meet some error like below :

Error of type [swift_connection_exception] with message [There was a problem reading line 1 of an SMTP response. The response so far was:


Error of type [swift_badresponseexception] with message [Expected response code(s) [250] but got response [530 5.7.0 Must issue a STARTTLS command first j26sm50181waf]]

here is one my test code :

Code: Select all

<?php
 ini_set("display_errors", true); error_reporting(E_ALL);

require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Authenticator/LOGIN.php";
 

$swift =& new Swift(new Swift_Connection_SMTP("smtp.gmail.com",465));
$conn =& new Swift_Connection_SMTP("smtp.gmail.com",465);
$conn->setUsername("vengtola@gmail.com");
$conn->setPassword("test22test");

//$conn->port=465;
//$conn->smtp_type   = 'ssl';
//$conn->connection  = 'smtp';
//$conn->smtp_host   = 'smtp.gmail.com';
//$conn->username  = 'vengtola@gmail.com';
//$conn->password  = 'test22test';


$msg =& new Swift_Message("Test");

$recipients =& new Swift_RecipientList();
$recipients->addTo("vetola2006@yahoo.com");


if(true==( $swift->send($msg, $recipients, new Swift_Address("vengtola@gmail.com","my name")) ))
    echo "sent";
else
    echo "errror";
?>
will you test with information above. what's wrong with my code or must i setup any thing else. :?:
does any one already test with gmail and get sending successfully? help me ? :D

thanks for correct mine.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Jun 01, 2007 2:08 am
by Chris Corbyn
Hmm, Gmail must have changed their port numbers. Actually, come to think of it, my mail client (Apple Mail) has been unable to connect to Gmail for the past two days so I dropped it and started using my ISP's SMTP. Maybe port 587 will work for you. Gmail has been getting more restrictive on the use of their SMTP server (limitting to 50 emails per half hour or something I think) -- maybe they've dropped support for it entirely.

I'll get back to you when I know more :)

Posted: Fri Jun 01, 2007 2:27 am
by Chris Corbyn
Hang on a minute. Someone hasn't read the documentation ;) 8)

Code: Select all

$swift =& new Swift(new Swift_Connection_SMTP("smtp.gmail.com", 465, SWIFT_SMTP_ENC_TLS));

Thanks for your answer

Posted: Sun Jun 03, 2007 8:40 pm
by vetola
I try and test. but i always met the error.

The SMTP connection failed to start tls://smtp.gmail.com , or The SMTP connection failed to start ssl://smtp.gmail.com.


i can not use my php with gmail . i decide to use Outlook Express.

Thanks again.

Posted: Tue Jun 05, 2007 8:51 am
by click
d11wtq wrote:I reasearched for a long time for ways to support STARTTLS (connect on port 25 unencrypted and then negotiate TLS from within that connection). It's just not viable with PHP since I'd have to write the TLS handling code myself.
Thats a shame.. I have the same problem.
Although OpenSSL seems to be installed on the server there is definitely something wrong with using the ssl:// or tls:// prefixes.
[The SMTP connection failed to start [tls://smtp.gmail.com:25]: fsockopen returned Error Number 115 and Error String 'Operation now in progress']
It seems fairly simple to do what you explained above using stream_socket_enable_crypto() in php5
(http://forum.powweb.com/showthread.php?t=73406) .. but doesn't help us people still using php4 :-/