Dysan Posted March 13, 2008 Share Posted March 13, 2008 What's the best secure way to send an hard-coded email using PHP? Also, how do you include the SMTP server details in the script? Can anybody give me an example to play around with? Quote Link to comment Share on other sites More sharing options...
msimonds Posted March 13, 2008 Share Posted March 13, 2008 Try this class > http://www.gerd-tentler.de/tools/mimemail/main.php I use it in all my applications and it works great. It has an example in the download: include('mimemail.inc.php'); $mail = new MIMEMAIL("HTML"); $mail->senderName = "sender name"; $mail->senderMail = "sender@email"; $mail->bcc = "bcc@email"; $mail->subject = "This is the subject line"; $mail->body = "Hello! This is a message for you."; // OR: $mail->body = "path/to/file"; $mail->attachments[] = "path/to/file1"; $mail->attachments[] = "path/to/file2"; ... $mail->create(); $recipients ='recipient1@email,recipient2@email,recipient3@email'; if(!$mail->send($recipients)) echo $mail->error; Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 13, 2008 Share Posted March 13, 2008 much easy this way <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com'; mail($to, $subject, $message, $headers); ?> Quote Link to comment Share on other sites More sharing options...
Dysan Posted March 14, 2008 Author Share Posted March 14, 2008 much easy this way <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com'; mail($to, $subject, $message, $headers); ?> How do I include the SMTP server details within the script Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.