Solved

iis Smtp sends my mail to badmail folder

Posted on 2009-04-13
11
612 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
11 Comments
 
LVL 26

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
 
LVL 26

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 26

Accepted Solution

by:
Dan McFadden earned 500 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 26

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now