Hi All,
Had this function ruinning on our web server for more than 8 years now and just now it's not sending emails.
It seems to fail on the Helo command.
Here is the output of the function
Had this function ruinning on our web server for more than 8 years now and just now it's not sending emails.
It seems to fail on the Helo command.
Here is the output of the function
Code:
SendMail Error 0 localhost misterdj Buffer RCPT TO error: 504 5.5.2 <misterdj>: Helo command rejected: need fully-qualified hostname Mail From [email protected] Mail To [email protected] Reply MessageType text/html; Subject Order Confirmation ---- Message ---- Copy Email<br><br>Order Confirmation<br><br>86.156.44.13<br><br><table border=0 cellspacing=0 cellpadding=4><tr><td align=center><a href=http://www.djsuperstore.co.uk> <img src=http://www.djsuperstore.co.uk/logos/djsuperstore.gif border=0><br>www.djsuperstore.co.uk</a></td><td> </td><td><b>DJ Superstore<br>Unit 5, Airborne Industrial Estate,<br>A127 Arterial Road, Leigh On Sea,<br>Essex, SS9 4EX, UK<br>Tel 01702 520020</td></tr></table><br> Order Confirmation Number :M-W-15699:<br><br> Placed Tuesday 18/11/2008 - 15:45:17</b><br><br> <table border=1 cellspacing=0 cellpadding=5 bordercolor=black class=t2bk><tr><td>Customer Number 11120<br>Mr Some Customer</td></tr></table> <br> Your Order :-<br><br> <table border=1 cellspacing=0 cellpadding=3 bgcolor=silver bordercolor=black> <tr><td><b>Qty<td><b>Order Code<td colspan=2><b>Description<td align=right><b>Unit Price<td align=right><b>Line Total <tr><td>1</td><td>106362<td nowrap>Pioneer</td><td>HDJ1000 Headphones<td align=right nowrap>£ 119.00<td align=right nowrap>£ 119.00 <tr><td colspan=3 rowspan=2> </td><td colspan=2>Shipping Charge<td align=right nowrap>£ 0.00</td></tr> <tr><td colspan=2>Order Total</td><td align=right nowrap>£ 119.00</td></tr> </table><br> Your order will be despatched as soon as possible.<br><br>Thank you for your order.<br><br>DJ Superstore ----------------- 86.156.44.13
Code:
FUNCTION SendMail( BYVAL MailFrom AS STRING, BYVAL MailTo AS STRING, BYVAL Reply AS STRING, BYVAL MessageType AS STRING, BYVAL Subject AS STRING, BYVAL Message AS STRING ) AS LONG ' LOCAL LocalHost AS STRING LOCAL TL1 AS long LOCAL Buffer AS STRING local TS1 as string ' ** Get the local host name HOST ADDR TO hTCP_GL HOST NAME hTCP_GL TO LocalHost ' ** Connect to mail server hTCP_GL = FREEFILE TCP OPEN "smtp" AT $MailHost AS hTCP_GL IF ERR THEN Buffer = "Error connecting to mailhost" GOTO SendError ELSE TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "220" THEN GOTO SendError END IF END IF ' ** Greet the mailhost TCP PRINT hTCP_GL, "HELO " + localhost TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "250" THEN Buffer = "HELO error: " + Buffer GOTO SendError END IF ' ** Tell the mailhost who we are TCP PRINT hTCP_GL, "MAIL FROM: <" + MailFrom + ">" TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "250" THEN Buffer = "MAIL FROM error: " + Buffer GOTO SendError END IF ' ** Tell the mailhost who the message is for TCP PRINT hTCP_GL, "RCPT TO: <" + MailTo + ">" TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "250" THEN Buffer = "RCPT TO error: " + Buffer GOTO SendError END IF ' ** Send the message TCP PRINT hTCP_GL, "DATA" TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "354" THEN Buffer = "DATA error: " + Buffer GOTO SendError END IF TCP PRINT hTCP_GL, "Content-Type: " + MessageType TCP PRINT hTCP_GL, "From: " + MailFrom TCP PRINT hTCP_GL, "To: " + MailTo IF Reply <> "" THEN TCP PRINT hTCP_GL, "Reply-To: " + Reply end if TCP PRINT hTCP_GL, "Subject: " + Subject TCP PRINT hTCP_GL, "" 'end of header ' ** Send the message WHILE LEN( Message ) > 0 TL1 = INSTR( Message, "ÿ" ) ' "ÿ"=chr$(255) IF TL1 = 0 THEN TCP PRINT hTCP_GL, Message; IF MessageType = "text/html;" THEN TCP PRINT hTCP_GL, "<BR>" end if IF Messagetype = "text/plain;" THEN TCP PRINT hTCP_GL, "" end if Message = "" ELSE TCP PRINT hTCP_GL, LEFT$( Message, TL1 - 1 ); IF MessageType = "text/html;" THEN TCP PRINT hTCP_GL, "<BR>" end if IF Messagetype = "text/plain;" THEN TCP PRINT hTCP_GL, "" end if Message = MID$( Message, TL1 + 1 ) END IF WEND TCP PRINT hTCP_GL, "." TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "250" THEN GOTO SendError END IF ' ** Say goodbye TCP PRINT hTCP_GL, "QUIT" TCP LINE hTCP_GL, Buffer IF LEFT$( Buffer, 3 ) <> "221" THEN Buffer = "QUIT error: " + Buffer GOTO SendError END IF TCP CLOSE hTCP_GL FUNCTION = - 1 ' Done EXIT FUNCTION SendError : FUNCTION = ERR TCP CLOSE hTCP_GL ' #IF %Environ = %Live ' ON ERROR RESUME NEXT ' TS1 = GetNextRef( $UserFilesDataDir + "Ref\Ref.wmm", "", 0, 9999999, 1 ) TL1 = FREEFILE OPEN $UserFilesDataDir + TS1 + ".wmm" FOR OUTPUT AS #TL1 ' STD_OUT( "An error has occured. " + STR$( ERR ) + " (error log generated)<br><br>") ' STD_OUT( "<a href=clg.cgi>Please click here to continue</a>") PRINT #TL1, "SendMail" print #TL1 print #TL1, "Error " ERR print #TL1, "localhost "localhost print #TL1, "Buffer " Buffer print #TL1, "Mail From " MailFrom print #TL1, "Mail To "MailTo print #TL1, "Reply " Reply print #TL1, "MessageType " MessageType print #TL1, "Subject " Subject print #TL1, "---- Message ----" print #TL1, Message print #TL1, "-----------------" PRINT #TL1, ENVIRON$( "REMOTE_ADDR" ) CLOSE #TL1 ' END FUNCTION
Comment