LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-05-2008, 02:52 AM   #1
ratcateme
Member
 
Registered: Feb 2008
Distribution: CentOS 5.4
Posts: 59

Rep: Reputation: 15
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.
 
Old 08-05-2008, 03:02 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Are you using the php mail() function, or doing your own SMTP negotiation?
 
Old 08-05-2008, 06:06 AM   #3
ratcateme
Member
 
Registered: Feb 2008
Distribution: CentOS 5.4
Posts: 59

Original Poster
Rep: Reputation: 15
hi thanks for the reply. i am doing my owne conection using fsockopen()

Scott.
 
Old 08-05-2008, 11:21 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
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?
 
Old 08-05-2008, 11:11 PM   #5
ratcateme
Member
 
Registered: Feb 2008
Distribution: CentOS 5.4
Posts: 59

Original Poster
Rep: Reputation: 15
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.
 
Old 08-05-2008, 11:22 PM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
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.
 
Old 08-06-2008, 01:57 AM   #7
ratcateme
Member
 
Registered: Feb 2008
Distribution: CentOS 5.4
Posts: 59

Original Poster
Rep: Reputation: 15
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.
 
Old 02-23-2009, 03:51 AM   #8
narada000
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
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
 
Old 02-23-2009, 03:52 AM   #9
narada000
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
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
 
Old 02-23-2009, 03:58 AM   #10
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with perl sending email with Gmail SMTP sadarax Programming 3 09-12-2009 07:17 PM
nbsmtp cannoct connect to Gmail SMTP, but Evolution can? why? mutable Linux - Newbie 0 11-28-2007 03:05 PM
exim4 sends with smtp.gmail.com otoomet LinuxQuestions.org Member Success Stories 0 09-10-2007 11:22 PM
SMTP Should stand for Stupid Mail Transfer Protocol ivj Linux - Software 0 07-23-2004 08:43 PM
SMTP and KMail and SMTP and Netscape Mail jazz... Linux - Newbie 5 10-11-2003 03:49 AM


All times are GMT -5. The time now is 01:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration