Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 633
  • Last Modified:

iis Smtp sends my mail to badmail folder

Im using IIS smtp service. the log message is:

Unable to deliver this message because the follow error was encountered: "This message is a delivery status notification that cannot be delivered.".

The specific error code was 0xC00402C7.


The message sender was <>.


The message was intended for the following recipients.
      info@kcstreets.com

AND--------------------------------------------------|||||||||||||||||---------------------------------------

Received: from webserver ([127.0.0.1]) by webserver with Microsoft SMTPSVC(6.0.3790.3959);
       Mon, 13 Apr 2009 23:03:11 -0500
Date: Mon, 13 Apr 2009 23:03:11 -0500
Subject: Joining Members
To: info@kcstreets.com
From:
Content-type: text/html
Return-Path: <>
Message-ID: <WEBSERVERGTxHXC8M5e00000002@webserver>
X-OriginalArrivalTime: 14 Apr 2009 04:03:11.0156 (UTC) FILETIME=[ED353740:01C9BCB5]

<br><hr><br>
First Name:  <br>
Last Name:  <br>
Email Address:  <br>
City:  <br>

and my php file is set to
localhost
port 25
<?php
error_reporting(E_ALL & ~E_NOTICE);
/* Email Variables */
 
	$emailsubject = 'Joining Members';
	$webmaster = 'info@kcstreets.com';
	
/* Gathering Data */
 
	$firstfield = $_POST['first'];
	$lastfield = $_POST['last'];
	$emailfield = $_POST['email'];
	$cityfield = $_POST['city'];
	
	$body = <<<EOD
<br><hr><br>
First Name: $first <br>
Last Name: $last <br>
Email Address: $email <br>
City: $city <br>
EOD;
 
	$headers = "From: $email\r\n";
	$headers .= "Content-type: text/html\r\n";
	$success = mail($webmaster, $emailsubject, $body, $headers);
	
	
/* Results Page */
 
	$theresults = <<<EOD
<html>
<head>
<title>Joined</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	background-color: #f1f1f1;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
}
-->
</style>
</head>
 
<div>
  <div align="left">Thank you for your interest!</div>
</div>
</body>
</html>
	
EOD;
echo "$theresults";
 
 
?>

Open in new window

0
clenh2o
Asked:
clenh2o
1 Solution
 
Dan McFaddenSystems EngineerCommented:
I suggest that you add code that includes an email address in the FROM field and retest.
0
 
clenh2oAuthor Commented:
Were would I add that in? would it go in the php.ini or the php script? or what code do i use. I see that there is no from. Wouldn't that need to be their email address?  
0
 
clenh2oAuthor Commented:
and my php.ini file is set to
localhost
port 25

and under that it says

From : info@kcstreets.com <----- I dont think this is right because i dont want it to be from info@kcstreet.com thats where i want it to go??
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Dan McFaddenSystems EngineerCommented:
I don't know PHP, but the error you indicated in your post is indicative of IIS SMTP complaining about no FROM address included in the email.  I would expect you to build the email in the PHP code.

According to the SMTP failure message you posted, the email is going to 'info@kcstreet.com."  This issue is a PHP code issue, not an IIS/SMTP issue.
0
 
clenh2oAuthor Commented:
how can I test my smtp server?  to make sure its working.
0
 
Dan McFaddenSystems EngineerCommented:
Here is VBScript I use to test SMTP relay.  just replace the following information (in the script), save the script and run it:

- .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="Your Server Name (FQDN) Here"
- strSender = "sender@yourdomain.com"
- strRecipient = "recipient@somedomain.com"

Cut and past the text inbetween the <code start> & </code stop> tags below.  Leave out the <code start> & </code stop> lines.  Save it to something like, SmtpTest.vbs and double-click it.  a Message box pops when it is complete, check your inbox for email.  If it never arrives, pull the SMPT logs from the server and look for the smtp conversation that matches the time you ran the script.

Have fun...


<code start>

'**********************************************************
'*
'*  Send a remote html email using CDO.SYS
'*  Dan McFadden - 10/30/2007
'*
'**********************************************************

'***** Global delcarations
Const CdoBodyFormatHTML = 0
Const CdoBodyFormatPlainText = 1
Const CdoMailFormatMime = 0
Const CdoMailFormatText = 1
Const CdoEncodingUUencode = 0
Const CdoEncodingBase64 = 1
Const CdoLow = 0
Const CdoNormal = 1
Const CdoHigh = 2

'***** Send email
Sub SendMail(thisImportance, thisSender, thisRecipient, thisSubject, thisBody)
    Dim objEmail, strSendFile
    Set objEmail = CreateObject("CDO.Message")
    objEmail.From = thisSender
    objEmail.To = thisRecipient
    objEmail.Subject = thisSubject
    objEmail.HTMLBody = thisBody
    With objEmail.Configuration
        .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="Your Server Name (FQDN) Here"
        .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Fields.Update
    End With
    objEmail.Send
    Set objEmail = Nothing
End Sub


'***** Main *****
Dim strImportance
Dim strSender
Dim strRecipient
Dim strSubject
Dim strBody

strImportance = CdoHigh
strSender = "sender@yourdomain.com"
strRecipient = "recipient@somedomain.com"
strSubject = "Your Subject Line"
strBody = "<strong>Some Text for the body of this email.</strong>"
Call SendMail(strImportance, strSender, strRecipient, strSubject, strBody)

Wscript.Echo "Done"
Wscript.Quit

</code stop>



0
 
clenh2oAuthor Commented:
Ok tested and smtp is working now i just need to figure out the php script and make it work right. I have googled everything i could think of and i am still unable to get it to send me an e-mail? I dont know what is wrong. It is the php script and thank you for pointing me in the right direction.
0
 
Dan McFaddenSystems EngineerCommented:
Is there an include file associated with your script?  I see a call to a function/subroutine called "mail".  The line is: $success = mail($webmaster, $emailsubject, $body, $headers);

But I do not see any code, in what you included, that includes a function definition.  If you can find that function and post it, I may be able to help out to resolve the PHP issue.
0
 
clenh2oAuthor Commented:
Fixed it!! It was a smtp setting the whole time my code was right!! well for the most part. Thanks for pointing me in the right direction. Its always nice to bounce ideas off of another IT Master.
0
 
MuralidharanpCommented:
hi clenh2o..
        i am having the same problem in php code.. could u please explain me how you had fixed it?.. please help me to solve this problem...
0
 
sillzCommented:
It would be really nice to know what that setting was.  Wea re having the same problem.  :-(
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Tackle projects and never again get stuck behind a technical roadblock.
Join Now