is From: firstname.lastname@example.org a valid email address hosted at dreamhost?
Try changing the $to variable also away from gmail. For testing I would use a dreamhost hosted email account. Once it’s working correctly you can try changing things such as the To address to see if it breaks again (it might with a gmail address… or AOL or comcast… all have been problem email domains in the past.)
Assuming that you are not seeing errors during submit, I suspect you’re dealing with a mail block/spam issue.
You might also add something like this right before or after the statement: mail($to, $subject, $messages, $headers);
$fp = fopen($mailcopyfile, “a”);
fputs($fp, $to . $subject . $messages );
which will cause the same info being emailed to be appended to a server file. If this part is working then you know the problem deals with email getting blocked.
forgot to mention to define $mailcopyfile