Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

iis Smtp sends my mail to badmail folder

Posted on 2009-04-13
11
Medium Priority
?
628 Views
Last Modified: 2013-12-13
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
Comment
Question by:clenh2o
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 28

Expert Comment

by:Dan McFadden
ID: 24137995
I suggest that you add code that includes an email address in the FROM field and retest.
0
 
LVL 1

Author Comment

by:clenh2o
ID: 24139212
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
 
LVL 1

Author Comment

by:clenh2o
ID: 24139251
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 28

Expert Comment

by:Dan McFadden
ID: 24140483
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
 
LVL 1

Author Comment

by:clenh2o
ID: 24142967
how can I test my smtp server?  to make sure its working.
0
 
LVL 28

Accepted Solution

by:
Dan McFadden earned 2000 total points
ID: 24150660
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
 
LVL 1

Author Comment

by:clenh2o
ID: 24158868
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
 
LVL 28

Expert Comment

by:Dan McFadden
ID: 24159443
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
 
LVL 1

Author Comment

by:clenh2o
ID: 24181844
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
 
LVL 5

Expert Comment

by:Muralidharanp
ID: 24645256
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
 

Expert Comment

by:sillz
ID: 38385031
It would be really nice to know what that setting was.  Wea re having the same problem.  :-(
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question