Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Sending email March 21, 2011 09:43AM |
Registered: 13 years ago Posts: 186 Rating: 0 |
Language: PHP<?php require_once(';includes/PHPmailer/class.phpmailer.php';); require_once (';includes/PHPmailer/class.smtp.php';); $to_name = ';First Last';; $to = ';recipient@domain.com';; $subject = ';Mail Test at ';. strftime(';%T';,time()); $message = ';This is a test';; $message = wordwrap($message,70); $from_name = ';First Second; $from = ';email@domain.com';; $mail = new PHPMailer(); $mail -> IsSMTP(); $mail -> Mailer = ';smtp';; $mail -> SMTPAuth = true; $mail -> SMTPSecure = ';ssl';; $mail -> Host = ';smtp.domain.com';; $mail -> Port = 465; $mail -> Username = ';emailI@domain.com';; $mail -> Password = ';password';; $mail -> FromName = $from_name; $mail -> From = $from; $mail ->AddAddress($to,$to_name); $mail ->Subject = $subject; $mail ->Body = $message; $result = $mail->Send; echo $result ? ';SENT'; : ';FAIL ';.$mail -> ErrorInfo; ?>
Re: Sending email March 21, 2011 11:40AM |
Registered: 13 years ago Posts: 60 Rating: 0 |
Re: Sending email March 21, 2011 04:18PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
The latter you are likely to use, so it needs to be "Language: PHP$to_name = ';First Last';; //versus $to_name ="$fname $sname";
Re: Sending email March 21, 2011 05:35PM |
Registered: 13 years ago Posts: 186 Rating: 0 |
Re: Sending email March 22, 2011 07:06AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHPecho $sname; // The value of $name is printed echo ';$sname';; // The word ';$name'; is printed echo "$sname"; // The value of $name is printed e.g. Johnny //Concatenation $sname = ';Johnny';; echo ';Your name is '; . $sname; // Prints Your name Johnny echo "Your name is $sname"; // Prints Your name Johnny
Language: PHPecho "<a href="http://www.there.com">Go to There</a>"; //parse error echo "<a href=\"http://www.there.com\">Go to There</a>"; //escape double quotes with a \ echo ';<a href=\"http://www.there.com"\>Go to There</a>';; // wil not work - will print what is between the single quotes, including the escape characters and double quotes echo "<a href=';http://www.there.com';>Go to There</a>"; // will also work but is rules incorrect and lazy echo "<a href=http://www.there.com>Go to There</a>"; and echo ';<a href=http://www.there.com>Go to There</a>';;// will also work but is slack coding and strict browsers will eventually start nailing you
Re: Sending email March 22, 2011 03:03PM |
Registered: 13 years ago Posts: 186 Rating: 0 |
Re: Sending email March 22, 2011 07:23PM |
Registered: 13 years ago Posts: 155 Rating: 0 |
Re: Sending email March 23, 2011 04:48PM |
Registered: 13 years ago Posts: 186 Rating: 0 |
Re: Sending email March 24, 2011 04:22PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Sending email March 25, 2011 09:19AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Sending email March 25, 2011 06:28PM |
Registered: 13 years ago Posts: 79 Rating: 0 |
Language: PHP$smtp_server_win = "196.36.104.67"; //Form data variables $name = $_POST[';fname';] ; $surname = $_POST[';sname';] ; $contact = $_POST[';cell';] ; $email = $_POST[';email';] ; $query = $_POST[';query';] ; if (isset( $smtp_server_win ) && strlen($smtp_server_win)) { ini_set( ';SMTP';, $smtp_server_win );}; date_default_timezone_set("Africa/Johannesburg"); if ($name!='; ';){ mail( "address@domain.com", "Website Query", "Client';s Name: $name\nClient';s Surname: $surname\nClient';s Contact number: $contact\nClient';s e-mail address: $email\nClient';s Query: $query", "From: query@domain.com" ); };
Re: Sending email April 20, 2011 12:08PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Language: PHP$student_info = "SELECT fname, sname, email, contact_flag FROM student"; $result = mysql_query($student_info) or die ("Could not retrieve student info for mail: " . mysql_error()); while($row = mysql_fetch_array($result)){ $fname = $row[';fname';]; $sname = $row[';sname';]; $email = $row[';email';]; $contact = $row[';contact_flag';]; $text .= $row[';fname';] . '; '; . $row[';sname';] . '; - '; . $row[';email';]. "\n"; $from = ';From: Info <info@spargweb.co.za>'; . "\r\n"; $to = $row[';email';]; $subject = "Successfully Registered"; $body = "Hi $fname $sname,\n\nHere is a list of all students currently registered.\n\n$text"; if(mail($to, $subject, $body , $from)) { header("location:student_man.php"); } }
Re: Sending email April 20, 2011 07:47PM |
Registered: 13 years ago Posts: 98 Rating: 0 |
Language: PHP$SQL5 = "SELECT course_student.sno, student.fname, student.sname, student.email FROM student LEFT JOIN course_student ON course_student.sno=student.sno WHERE course_student.cid=$cid"; $result5 = mysql_query($SQL5); while ($row5 = mysql_fetch_array($result5)) { $msg = $row5[';fname';] . " " . $row5[';sname';] . " " . $row5[';email';] . "\n"; } $to = $email; $subject = "Registation"; $message = $msg; $from = "stefan.wiswedel@gmail.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers);
then it actually prints all the names, surnames and emails of all the students registered for the same course selected in the form.Language: PHPecho $row5[';fname';] . " " . $row5[';sname';] . " " . $row5[';email';] . "\n"
Re: Sending email April 20, 2011 08:00PM |
Registered: 13 years ago Posts: 98 Rating: 0 |
Re: Sending email April 20, 2011 08:58PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Sending email April 20, 2011 09:00PM |
Registered: 13 years ago Posts: 98 Rating: 0 |
Re: Sending email April 20, 2011 09:10PM |
Registered: 13 years ago Posts: 98 Rating: 0 |
Re: Sending email April 20, 2011 09:13PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Sending email April 20, 2011 09:36PM |
Registered: 13 years ago Posts: 98 Rating: 0 |
Language: PHPwhile ($row5 = mysql_fetch_array($result5)) { $student_list .= $row5[';fname';] . " " . $row5[';sname';] . " " . $row5[';email';] . "\n"; $all_emails .= $row5[';email';] . ","; } $to = $all_emails; $subject = "New students added to" . " " . $course; $message = "Here is a full list of all students registered for" . " " . $course . " " . "that are happy to be contacted." . "\n \n" . $student_list; $from = "stefan.wiswedel@gmail.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers);
Re: Sending email April 20, 2011 09:49PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Sending email April 21, 2011 09:19AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHP$five=mysql_query("SELECT * FROM students order by sname ASC"); $nummail = mysql_numrows($five); $i = 0; while ($i<$nummail) { $five_fname= mysql_result($five,$i,';fname';); $five_sname= mysql_result($five,$i,';sname';); $five_email .= mysql_result($five,$i,';email';).","; $i++; } $to = $five_email; echo "$to";
Re: Sending email April 21, 2011 09:23AM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Language: PHP$nummail = mysql_numrows($five);
Language: PHP$nummail = mysql_num_rows($five);
Re: Sending email April 21, 2011 09:30AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Sending email April 21, 2011 09:45AM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Re: Sending email April 23, 2011 05:55PM |
Registered: 13 years ago Posts: 263 Rating: 0 |
Language: PHP$num = mysql_num_rows($result); $i = 0; while($i < $num){ $row = mysql_fetch_array($result); $mail = $row[';email';]; $fname = mysql_result($result, $i, ';fname';); $sname = mysql_result($result, $i, ';sname';); $email .= mysql_result($result, $i, ';email';).","; $text .= $fname . '; '; . $sname . '; - '; . $mail. "\n"; $i++; }
Re: Sending email April 24, 2011 07:31PM |
Registered: 13 years ago Posts: 98 Rating: 0 |
Re: Sending email April 25, 2011 08:09AM |
Registered: 13 years ago Posts: 186 Rating: 0 |
Re: Sending email April 25, 2011 08:27AM |
Registered: 13 years ago Posts: 263 Rating: 0 |