Jump to content

mail function help


lawnninja

Recommended Posts

I have a php that accesses a php to mail an email.
The first php file has a  To textbox, Subject textbox, Message box and a File Upload box.
When I press send I accesses  mail.php (below)

[code]

<?php

$to = "[email protected]";
$subject = "mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";

?>

[/code]

I want it so To in the above code draws from what my textbox has in it for To. Same with Subject and Message. I also want it so it draws to find out username to tell the other person who it was sent form. I know that you draw it form the session somehow. Here is a piece of the code, I'm using that log's people in.

[code]
{
// Register $myusername, $mypassword and redirect to file "main.php"
session_register("myusername");
session_register("mypassword");
header("location:main.php");
}
[/code]

Finally, I want to sent emails with attachments. I have a box that loads files into it.

[code]<td width="84%"><input name="ufile" type="file" id="ufile" size="35" /></td>[/code]

I want it so when you press sent the mail.php will upload the file and send it with the email and then delete it from the server. Can this all be done?
Link to comment
https://forums.phpfreaks.com/topic/28331-mail-function-help/
Share on other sites

Ok I've figure out you use this code to talk to textboxes.
[code] $_POST['Type the Name of it here'];[/code]

but I still need to know how to get it so it uses your username and then @hiddleymail.com and how to send uploaded files.......

Also does anyone know what the line
[code]$headers = "From: $from";[/code]
means? Do I have to change anything?
Link to comment
https://forums.phpfreaks.com/topic/28331-mail-function-help/#findComment-129583
Share on other sites

Ok, I know what the header is for know but I dont know how to draw username from a seesion of use the session to access mysql to input the username. I found a tutorial that draws from mysql but don't know how to apply it.
http://www.phpeasystep.com/mysql/6.html

Any help is useful  ;D Thanks
Link to comment
https://forums.phpfreaks.com/topic/28331-mail-function-help/#findComment-130090
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.