The following code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
ob_start();
include('mplookup.php');
ob_end_clean();
$email = $_POST['emailfrom'];
require_once "mail/Mail.php";
$from = "***********************";
$to = "************************";
$subject = "Sisi's visit to the UK: Sent using the ERC's Tool";
$text = $_POST['text'];
$address = $_POST['address'];
$city = $_POST['city'];
$footer = '<br><em><strong>Disclaimer: "Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of EG4DEMUK. EG4DEMUK will not accept any liability in respect of defamatory or threatening communication. If you would like to raise a complaint about an email sent using our tool, please contact us at <a href="mailto:ercegypt.uk@ercegypt.org?subject=Email%20Complaint"></a>".</strong></em><p>-----------------------------------------------------------</p>
The ERC is an organisation that brings together Egyptian citizens and movements abroad, irrespective of their political or ideological affiliations. We share in common a belief in the principles of the January 25th Revolution and oppose all aspects of corruption and dictatorship in Egypt. We believe in constitutional legitimacy and work for the establishment of a civil state that reflects the will of the Egyptian people and their freedom in choosing their government.</p>';
$postcode = $_POST['postcode'];
$name = $_POST['flname'];
$body = $text.$name."<br />".$address."<br />".$city."<br />".$postcode."<br />".$footer;
$host = "****************************************
$port = "***";
$username = "************************";
$password = "**************";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
'MIME-Version' => "1.0",
'Content-type' => "text/html; charset=iso-8859-1\r\n\r\n");
'Reply-To' => $email,
"BCC: ****************\r\n";
"CC: $email\r\n";
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
This returns the error:
[Sun Jul 26 21:41:01.402278 2015] [:error] [pid 3246] [client 127.0.0.1:57710] PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /var/www/html/smtpmail/form.php on line 35, referer: http://localhost/smtpmail/mplookup.php
Any help is much appreciated.
This particular error has been solved. However, a new error occurs. New code:
<?php
ob_start();
include('mplookup.php');
ob_end_clean();
include("mail/Mail.php");
/* mail setup recipients, subject etc */
$recipients = "******************";
$headers["From"] = "ercegypt.uk@ercegypt.org";
$headers["To"] = "********************";
$headers["Subject"] = "Sisi's visit to the UK: Sent using the ERC's Tool";
$email = $_POST['emailfrom'];
$human = $_POST['human'];
$text = $_POST['text'];
$address = $_POST['address'];
$city = $_POST['city'];
$footer = '<br><em><strong>Disclaimer: "Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of EG4DEMUK. EG4DEMUK will not accept any liability in respect of defamatory or threatening communication. If you would like to raise a complaint about an email sent using our tool, please contact us at <a href="mailto:ercegypt.uk@ercegypt.org?subject=Email%20Complaint"></a>".</strong></em><p>-----------------------------------------------------------</p>
The ERC is an organisation that brings together Egyptian citizens and movements abroad, irrespective of their political or ideological affiliations. We share in common a belief in the principles of the January 25th Revolution and oppose all aspects of corruption and dictatorship in Egypt. We believe in constitutional legitimacy and work for the establishment of a civil state that reflects the will of the Egyptian people and their freedom in choosing their government.</p>';
$postcode = $_POST['postcode'];
$name = $_POST['flname'];
$message = $text.$name."<br />".$address."<br />".$city."<br />".$postcode."<br />".$footer;
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "******************************";
$smtpinfo["port"] = "465";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "*******************";
$smtpinfo["password"] = "**************";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
if ($_POST['submit'] && $human == '4')
{
if ($mail_object->send($message,$headers))
{
echo '<p>Your message has been sent! Thank you for participating in EG4DEMUK\'s campaign.</p>';
}
else
{
echo '<p>Something went wrong, please go back and try again!</p>';
}
}
?>
New error:
[Sun Jul 26 22:34:41.064227 2015] [:error] [pid 3240] [client 127.0.0.1:58834] PHP Warning: Missing argument 3 for Mail_smtp::send(), called in /var/www/html/smtpmail/form.php on line 32 and defined in /var/www/html/smtpmail/mail/Mail/smtp.php on line 245, referer: http://localhost/smtpmail/mplookup.php