954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

NEWBIE getting an understanding of formmail

I'm hoping that someone will give me a moment so I can understand how formmail works so that I can more effectively troubleshoot my problems.

Background:
I'm downloaded a very basic formmail to use on our intranet site for employees to respond to. I'm testing this on a XP Pro machine and plan to move it to the Windows 2003 server once testing is done. Our email (Exchange) is hosted remotely by ASP-one. Using IIS version 5.2

Now, excuse my ignorance but I've had no exposure to formmail before and trying to put the pieces together.

I've installed PHP 5.2.6 and running a php script from Tectite.com (see attached). I run http://testserver/fm.php?testalert=1 and it returns "Test message sent. Check your email".

Here is where is need an understanding. Because i don't see anywhere that you configure your SMTP server then i'm assuming you need to setup IIS SMTP Virtual Server. So I did this using a SMART HOST setup to ASP-ONE SMTP and then tried another ISP which we use currently for other SMTP mail. Mail goes through the queue and then into BADMAIL.
I don't know what I am missing.

Any suggestions?

HELP:$

Diane

Attachments fm.php (373.21KB)
darmstrong
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

It is possible that no from address is set. That may be the cause of the server rejecting your message. You can check the message details for any headers.

pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

I think this may be what is confusing me... Our email server uses authenticated SMTP which within the Virtual SMTP server I configure my mailbox userID and PW. My email address in the fm.php is different then the credentials which are required for the SMTP server.

What settings should I be using within the fm.php? Should they match my SMTP server which is configured to match our local domain name or should it match my remote email credentials?

Thanks
Diane

darmstrong
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

If I may, I recommend using PHPMailer which you can find here http://phpmailer.codeworxtech.com/ . This is an amazing class which I have worked with many times and you will find documentation on their website as well as examples in this downloaded zip file.

Here you will see that you actually define the smtp server in your script.

<?php

//error_reporting(E_ALL);
error_reporting(E_STRICT);

date_default_timezone_set('America/Toronto');
//date_default_timezone_set(date_default_timezone_get());

include_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

$body             = $mail->getFile('contents.html');
$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "mail.worxteam.com"; // SMTP server

$mail->From       = "name@yourdomain.com";
$mail->FromName   = "First Last";

$mail->Subject    = "PHPMailer Test Subject via smtp";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$mail->AddAddress("whoto@otherdomain.com", "John Doe");

$mail->AddAttachment("images/phpmailer.gif");             // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

?>
Attachments phpMailer_v2.1_.zip (114.83KB)
R0bb0b
Posting Shark
998 posts since Jun 2008
Reputation Points: 358
Solved Threads: 89
 

PhPMailer is then used in place of the IIS Virtual SMTP Server?

This may be a really dumb question but like i said... I'm still trying to put the pieces together here to make sense and to make it work!!

thanks for your assistance

D

darmstrong
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

You will have to use PHPMailer for an SMTP with autentication as PHP does not let you add authentication for the basic mail() command.

samarudge
Posting Whiz
359 posts since May 2008
Reputation Points: 26
Solved Threads: 31
 

I have PHPMailer up and running and sending mail. Do you have a recommendation for a FORMMAIL program to use with PHPMailer?

darmstrong
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You