LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP SMTP connection to gmail SMTP protocol violation (https://www.linuxquestions.org/questions/programming-9/php-smtp-connection-to-gmail-smtp-protocol-violation-660541/)

ratcateme 08-05-2008 02:52 AM

PHP SMTP connection to gmail SMTP protocol violation
 
I am trying to connect to gmail i get this error
Code:

451 4.5.0 SMTP protocol violation, see RFC 2821 y5si1689664tia.8
here is a complete run down of the transfer
Code:

220 mx.google.com ESMTP y5si1689664tia.8
>>> EHLO *******
250-mx.google.com at your service, [118.92.187.121]
250-SIZE 28311552
250-8BITMIME
250 ENHANCEDSTATUSCODES
>>> MAIL FROM: <scott@*****>
250 2.1.0 OK
>>> RCPT TO: <******@gmail.com>
250 2.1.5 OK
>>> DATA
354 Go ahead
>>> From: "Scott" <scott@******>
To: <******@gmail.com>
Subject: test through gmail
Date: Tue, 5 Aug 2008 19:45:16 +1200
Message-ID: <000001c8f6cf$33d1f4c0$0301010a@BOBDESK>
MIME-Version: 1.0
Content-Type: multipart/alternative;
.boundary="----=_NextPart_000_0001_01C8F733.C906D4C0"
X-Mailer: Microsoft Office Outlook 11
Thread-Index: Acj2zzM0qYraPOsLSLqhETl3/yHFtA==
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198

This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C8F733.C906D4C0
Content-Type: text/plain;
.charset="us-ascii"
Content-Transfer-Encoding: 7bit

Test

Test to gmail


------=_NextPart_000_0001_01C8F733.C906D4C0
Content-Type: text/html;
.charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
.{margin:0cm;
.margin-bottom:.0001pt;
.font-size:12.0pt;
.font-family:"Times New Roman";}
a:link, span.MsoHyperlink
.{color:blue;
.text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
.{color:purple;
.text-decoration:underline;}
span.EmailStyle17
.{mso-style-type:personal-compose;
.font-family:Arial;
.color:windowtext;}
@page Section1
.{size:612.0pt 792.0pt;
.margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
.{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-NZ =
style=3D'font-size:
10.0pt;font-family:Arial'>Test<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-NZ =
style=3D'font-size:
10.0pt;font-family:Arial'>Test to gmail<o:p></o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0001_01C8F733.C906D4C0--
.

451 4.5.0 SMTP protocol violation, see RFC 2821 y5si1689664tia.8

i have looked over and over my code and i cant see any reason for the issue

Scott.

Mr. C. 08-05-2008 03:02 AM

Are you using the php mail() function, or doing your own SMTP negotiation?

ratcateme 08-05-2008 06:06 AM

hi thanks for the reply. i am doing my owne conection using fsockopen()

Scott.

Mr. C. 08-05-2008 11:21 AM

Ok, then you are going to have to explain or show more how you are managing the conversation.

Can I presume you've read the relevant *821 RFCs?

ratcateme 08-05-2008 11:11 PM

i have done some more testing i tried to send mail to hotmail.com and go a message back sending me to a website that said because i am using an IP in a dynamic ip block i am being blocked by most mail servers

Scott.

Mr. C. 08-05-2008 11:22 PM

That sounds like a second reason for the reject. This wouldn't explain gmail's SMTP violation message, which I'm willing to believe is a correct diagnostic.

ratcateme 08-06-2008 01:57 AM

yea i have been using a DNS from dyndns.com now i think i will have a talk to my ISP about getting a static IP and proper DNS entry
Thanks for the help anyway

Scott.

narada000 02-23-2009 03:51 AM

gmail smtp with my host
 
Hi,
I have a problem with my smtp.Because i'm using free hosting plan.But they have disable smtp server in my host.So I need to use free smtp service such as gmail.


Any one can help me,Can I use gmail as smtp in with my host.
Note-Host doesn't offer smtp for my plan.
Can I use phpmailer or sendmail

Bye

narada000 02-23-2009 03:52 AM

Hi,
I have a problem with my smtp.Because i'm using free hosting plan.But they have disable smtp server in my host.So I need to use free smtp service such as gmail.

Here code I use for test my host's ports.


PHP Code:


$fp   
=   fsockopen("www.google.com",   80,   &$errno,   &$errstr,   10);  // work fine
  
if(!   $fp
      echo   
"www.google.com -  $errstr   ($errno)<br>\n"
  else 
      echo   
"www.google.com -  ok<br>\n";

 
      
$fp   =   fsockopen("smtp.gmail.com",   465,   &$errno,   &$errstr,   10);   // NOT work
  
if(!   $fp
      echo   
"smtp.gmail.com 465  -  $errstr   ($errno)<br>\n"
  else 
      echo   
"smtp.gmail.com 465 -  ok<br>\n"
     
     
      
$fp   =   fsockopen("smtp.gmail.com",   587,   &$errno,   &$errstr,   10);   // NOT work
  
if(!   $fp
      echo   
"smtp.gmail.com 587  -  $errstr   ($errno)<br>\n"
  else 
      echo   
"smtp.gmail.com 587 -  ok<br>\n";       

echo 
"<br />".phpinfo();
      
?> 




here result Got when I run it on brower.

PHP Code:

[COLOR="Blue"]\n"; else echo "www.google.com ok
\n"; $fp = fsockopen("smtp.gmail.com", 465, &$errno, &$errstr, 10); // NOT work if(! $fp) echo "smtp.gmail.com 465 $errstr ($errno)
\
n"; else echo "smtp.gmail.com 465 ok
\n"; $fp = fsockopen("smtp.gmail.com", 587, &$errno, &$errstr, 10); // NOT work if(! $fp) echo "smtp.gmail.com 587 $errstr ($errno)
\
n"; else echo "smtp.gmail.com 587 ok
\n"; echo "
".phpinfo(); ?>
[/COLOR] 




Any one can help me,Can I use gmail as smtp in with my host.
Note-Host doesn't offer smtp for my plan.
Can I use phpmailer or sendmail

Bye

Mr. C. 02-23-2009 03:58 AM

Its hard to tell what is not working without output and error codes. Are we to presume that you cannot connect to port 587?

Also, note that sending via gmail requires SMTP AUTH.


All times are GMT -5. The time now is 10:04 AM.