PHP Mail Function
5 posts
Page 1 of 1
On this tutorial I will teach you the basics of creating a PHP/HTML Mail Form
First of all you must make sure MAIL is allowed on your server
okay, so the syntax we are going to be using will be.
PHP Code
This piece of code could be implimented into a registration system that sends a confirmation message to the user, or maybe a welcome email ectect.
You could use a HTML form in order to post information into the variables when sending the email to create a form, and then input jQuery to make it nicer/validation.
First of all you must make sure MAIL is allowed on your server
okay, so the syntax we are going to be using will be.
Code: Select all
So the simple way for this ismail(to,subject,message,headers,parameters)
PHP Code
Code: Select all
It's pritty easy really, the only 'difficult' bit would be remembering the syntax<?php
//The email your sending the message to
$to = "someone@example.com";
//The subject you wish to appear
$subject = "Test mail";
//The message
$message = "Hello! This is a simple email message.";
//Who it's from
$from = "someonelse@example.com";
//Define the headers
$headers = "From: $from";
//The syntax (only this time using the variables to send)
mail($to,$subject,$message,$headers);
//Confirmation message
echo "Mail Sent.";
?>
This piece of code could be implimented into a registration system that sends a confirmation message to the user, or maybe a welcome email ectect.
You could use a HTML form in order to post information into the variables when sending the email to create a form, and then input jQuery to make it nicer/validation.
Back Aegean sorry not been on i.v just been moving.
You can also specify the mail server and the default sender address with this:
Code: Select all
ini_set("SMTP", "smtp.domain.com");
ini_set("sendmail_from", "user@domain.com");
Cool mate will help sumone i hope thank's for addin to the code.
Back Aegean sorry not been on i.v just been moving.
I think this was posted previously.
Last edited by mandai on Sun Apr 29, 2012 9:16 pm, edited 1 time in total.
On every post that he makes,i see messages from other people that he copied sources from another pages...lol
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023