| Author |
Message |
psptpr98
Joined: 16 Dec 2004 Posts: 9
|
Posted: Mon May 30, 2005 6:52 am Post subject: php form and sending email using smtp |
|
|
Hello actwd,
I am using a php form to try and send Email using smtp, but its not working is my domain capable of sending mail this way?
Thanks
fb |
|
| Back to top |
|
 |
ar2949
Joined: 11 Dec 2004 Posts: 23
|
Posted: Tue May 31, 2005 2:34 am Post subject: |
|
|
Yes your domain can send Email using PHP. After you collect the information from your Email form and assign them to variables you need to use the following line of code to send the Email.
$mailsend = mail(address,subject,message,header);
address is the Email address that its going to. If you want someone to submit Email to you from your website then you can assign a variable
$to = "you@yourdomain.com";
subject is done the same way.
$subj = "you have new Email";
message is the formatted body of the Email. You can include here the other variables that the user may have submitted in the form. For example first name, last name, etc.
$message = "Submitted by: $firstName $lastName";
header is the from part of the Email message. It is formatted as follows.
$header = "From: $Email";
where $Email is the Email address of the user (user@hisdomain.com) that you collected from the form and assigned to the $Email variable.
So based on the examples I have shown here, you would format the mail line as follows:
$mailsend = mail("$to", "$subj", "$message", "$header");
The resulting Email would look something like this:
To: you@yourdomain.com
From: user@hisdomain.com
Subject: you have new Email
Message: Submitted by: John Doe
There is also special code for assigning the form information to the variables. Let me know if you are having trouble with this part of the process.
Hope this helps. You can find this information in any good PHP book or online. |
|
| Back to top |
|
 |
psptpr98
Joined: 16 Dec 2004 Posts: 9
|
Posted: Tue May 31, 2005 3:27 am Post subject: php forms sending mail via smtp |
|
|
| The scripts that the form uses only sends using smtp not php mail, I need to know if my domain can send smtp mail. If not I will have to recode the hole thing to work with php mail. Thanks for the help any other ideas? |
|
| Back to top |
|
 |
|