[Webmakers] Help with PHP mail function

Angela Such Angela.Such at health.ri.gov
Fri May 4 09:26:57 EDT 2012


Although we are not 'live' with this email process, this simple php mail code works on the production web server for us at HEALTH:
 
$name=$_POST['contact_name'];
checkOK($name);
 
$address1=$_POST['contact_address'];
checkOK($address1);
 
$to="angela.such at health.ri.gov";
$message="Publications Online Ordering:  \n  Name: $name \n $address1 \n ";
if(mail($to,"Online Ordering",$message, "From: DOH Website\n"))
{ 
echo "Thanks for your order.";
} else {
echo "There was a problem sending the order/email. Please check that you filled in the form correctly.";
}   
 
 
 
BTW - it's great to get a "shout out" for help from a fellow web person... We are not alone!
Looking forward to more communications with the this group.
Regards,
Angela Such
 
Angela J. Such
Webmaster Assistant
RI Dept of Health
401-222-1415 room 407


>>> "Patrick Marr" <pmarr at treasury.ri.gov> 5/3/2012 3:04 PM >>>

We do, and our code looks like this:
 
               $headers  = 'MIME-Version: 1.0' . "\r\n";
               $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
               $headers .= 'From: TREASURY WEBSITE <no-reply at treasury.ri.gov>' . "\r\n";
               mail($to, $subject, $message, $headers);

--------------------------------------------
Patrick Marr 401.462.7664 o | 401.559.3727 m

 

From:webmakers-bounces at listserve.ri.gov [mailto:webmakers-bounces at listserve.ri.gov] On Behalf Of Steve Beauchemin
Sent: Wednesday, May 02, 2012 10:49 PM
To: webmakers at listserve.ri.gov
Cc: Mike Aubin; Bill Del Prete (DOA); Matthew Lang (DOT); Andrew Reidl (DOA)
Subject: [Webmakers] Help with PHP mail function

 

Hello everyone--

 

I've been away from PHP for quite awhile and can use some help please.

 

I have PHP script that is no longer sending email since the Enterprise Server Group made a change to the DNS settings. Does anyone else use the PHP MAIL() function to send email from a form?

 

I need to change set the from but can't get it to work... Bill Del Prete suggested the DNS name (mailtran.admin.ri.gov) but that's not working for me...

 

Here's what I had that worked prior to the change:

 

foreach ($addresses as $to){
mail($to,$subject,$message,$headers,"-f from");

 

I tried to add it to the headers as so but still no joy (the handler page does give me any errors, so the emails seem to be getting there, the server must not be sending them because I don't have the from set correctly):

 

 

$headers = "Content-Type: text; charset=ISO-8859-1\r\n";

$hearers .= "cc: <<list of emails>>;

$headers .= "from:mailtran.admin.ri.gov";   << ADDED THIS LINE TO SCRIPT AND REMOVED -f from

 

 

 

Thanks, Steve

 

 

 

 

 

 

___________________________________________________

Stephen M. Beauchemin
State of Rhode Island
Division of Information Technology - DMV IT Manager

Aime Forand Bldg. Room 230A
600 New London Ave

Cranston, RI 02920
stephen.beauchemin at doit.ri.gov 
Phone:(401)462-4704
Cell: (401)641-5956
Fax:(401)462-5790

This e mail and any attachments thereto contain confidential and/or privileged information from the State of RI Department of Administration, Division of Information Technology.  It is intended only for the use of the named addressee(s).  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this e mailed information is strictly prohibited and unauthorized.  If you receive this e mail in error, please immediately notify the sender by e mail or telephone and permanently delete all copies of this e mail and any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserve.ri.gov/pipermail/webmakers/attachments/20120504/ed5c871f/attachment.html 


More information about the Webmakers mailing list