Okay, you can remove the echo and die statements now, the process of inserting and updating is working as expected
Now on to e-mail.
Are you running PHP on a local server? ie: Your PC, or on a remote server?
Is it a Windows Server or Linux Server?
2a) If Windows, are you using Apache or IIS?
Do you know your SMTP information for your school’s email server?
3a) Do you know the SMTP server name/address? usually smtp.mydomain.com
3b) Do you know if a username and password are required for sending e-mail through the smtp server?
3b1) If Yes, do you know what the username and password are?
//After teacher has entered marks… $message =<<<EMAIL_MESSAGE
'Dear Student, for your information, scores for your most recent examination have been uploaded. Please visit Med Buddy to view your score. Thank you.
should it stay there/?
1.i m running it on my localhost
3. nope, i don’t know the SMTP information for the schools email server… …
require_once(‘…/class.phpmailer.php’); ///WHERE IS THE LOCATION FO THIS FILE?
$mail = new PHPMailer(true);
$mail->IsSMTP(); ////////////////////////SHOULD I LEAVE IT LIKE THIS??
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = “tls”; // sets the prefix to the servier
$mail->Host = “smtp.gmail.com”; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = “firstname.lastname@example.org”; // GMAIL username
$mail->Password = “yourpassword”; // GMAIL password
//This is the “Mail From:” field
$mail->SetFrom(‘email@example.com’, ‘First Last’);
//This is the “Mail To:” field
$mail->AddAddress(‘firstname.lastname@example.org’, ‘John Doe’);
$mail->Subject = ‘PHPMailer Test Subject via mail(), advanced’;
$mail->Body = “Hi!
Extract the download into your php script folder hiearchy, and include it in your class.phpmailer.php file
Leave the IsSMTP (especially if you plan to use gmail to send your communication).
Update the appropriate auth variables.
Run the script.
Once it sends you an e-mail, let me know and I’ll help you extract it to hide a lot of the common components so you can have a one line call to replace mail() with.
function send_email($to, $subject, $message)
// Paste PHP Mailer code, change
// $mail->AddAddress('email@example.com', 'John Doe'); to $mail->AddAddress($to);
// $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; to $mail->Subject = $subject;
// $mail->Body = "Hi! \
This is my first e-mail sent through PHPMailer."; to $mail->Body = $message;
Then where you have mail(), you can replace the word mail with send_email
k, but there was one little thing i thought would be nice if we do it,
in this part of the php mailer code,
$mail->Subject = ‘New Scores Uploaded’; i wished to replace “New Scores” with $_POST[“subject”]… but it gave me some ugly error about “”" apostrophes and stuff, what is the right way to go about th is??