Hello Folks. I want to first appreciate for all the help that i have received here. I am pretty new to PHP and im trying to use PHP mailer for my SMYP settings. With the settings below, i tried to send the mail, but after a long time of loading, it just stops with a blank page. I set up and error report, that would let me know whether the message was sent or not, but i got no error message, just blank screen. I think its the STMP settings. Im supposed to put my ISP's Username and Password here. -
$mail->IsSMTP();
-
$mail->Host = "mail.example.com";
-
$mail->Port = 25;
-
$mail->SMTPAuth = false;
-
$mail->Username = "yourname@example.com";
-
$mail->Password = "yourpassword";
-
I originally put my Gmail username and password up there.
This is the Full Code -
<?php
-
-
-
require_once("../zoomie_files/includes/PHPmailer/PHPMailerAutoload.php");
-
-
-
$to_name = "Test Mail";
-
$to = "timothyazubuikeh@gmail.com";
-
$subject = "Mail Test at ".strftime("%T", time());//Provides the time
-
$message ="This is a Test. Ignore the inbox";
-
$message = wordwrap($message, 70);
-
$from_name = "Timothy Azubuikeh";
-
$from = "admin@zoomie.com";
-
-
-
//PHP SMTP version default
-
$mail = new PHPMailer;
-
-
$mail->IsSMTP();
-
$mail->Host = "gmail.com";
-
$mail->Port = 25;
-
$mail->SMTPAuth = false;
-
$mail->Username = "my_personal_email@gmail.com";
-
$mail->Password = "my_password";
-
-
$mail->FromName = $from_name;
-
$mail->From = $from;
-
$mail->AddAddress($to, $to_name);
-
$mail->Subject = $subject;
-
$mail->Body = $message;
-
-
-
if (!$mail->send())
-
{
-
echo "Mailer Error: " . $mail->ErrorInfo;
-
}
-
else
-
{
-
echo "Message sent!";
-
}
-
-
-
?>
-
-
Please i need help with the SMTP settings or whatever the issue with the code is. Thanks
9 2517
Thanks Luuk, before i try it out, do you mean that the email and password info i put there were correct?? Thanks.
Thanks Luuk. I change the false to true in
. It still did the same thing it did when SMTPAuth was false. (loaded for a long time and came up with a blank page).
What do you think is the problem???
Thanks Luuk. The article you gave me is about just about the PHP mail() function.
When you talk about log files and 'library which is more than 4 years old', honestly, i dont really understand would be grateful if you explained better. Im a novice.
I ran this code -
-
<?php
-
-
$inis = Array('SMTP', 'smtp_port', 'sendmail_path');// from not important
-
foreach($inis as $key=>$val){
-
echo "\t<p>{$val}</p>\n<code>\n";
-
var_dump(ini_get($val));
-
echo "</code>\n";
-
};
-
And its output was
SMTP
string(9) "localhost"
smtp_port
string(2) "25"
sendmail_path
bool(false)
I also ran this code to test the STMP class to see whether a connection can be made to the server -
date_default_timezone_set('Etc/UTC');
-
-
require ("../zoomie_files/includes/PHPmailer/PHPMailerAutoload.php");
-
-
//Create a new SMTP instance
-
$smtp = new SMTP;
-
-
//Enable connection-level debug output
-
$smtp->do_debug = SMTP::DEBUG_CONNECTION;
-
-
try {
-
//Connect to an SMTP server
-
if ($smtp->connect('www.gmail.com', 25)) {
-
//Say hello
-
if ($smtp->hello('localhost')) { //Put your host name in here
-
//Authenticate
-
if ($smtp->authenticate('my_personal_email@gmail.com', 'my_pasword')) {
-
echo "Connected ok!";
-
} else {
-
throw new Exception('Authentication failed: ' . $smtp->getLastReply());
-
}
-
} else {
-
throw new Exception('HELO failed: '. $smtp->getLastReply());
-
}
-
} else {
-
throw new Exception('Connect failed');
-
}
-
} catch (Exception $e) {
-
echo 'SMTP error: '. $e->getMessage(), "\n";
-
}
-
//Whatever happened, close the connection.
-
$smtp->quit(true);
-
And its output was this.
2015-04-07 20:34:50 Connection: opening to www.gmail.com:25, t=30, opt=array ( ) 2015-04-07 20:34:50 Connection: opened
But the script still does as before,(blank page). Hasnt a connection to a server been made? What do you think is the problem? Thanks Luuk for your help. Thanks.
Luuk 1,047
Expert 1GB
I cannot find the file you included on line#3 ("PHPMailerAutoload.php"), I does not exist in PHPMailer, at least not in the version I downloaded from: http://sourceforge.net/projects/phpmailer/
Do I have an old, or wrong, version?
What I mean about 'more than 4 years old' is the dates on the site: http://www.worxware.com/kbn/?category_id=23
Back to the topic, you seem to have the need to send email from PHP.
1) What kind of email do you want to send?
a) just text
b) HTML
c) text + attachment
d) HTML + attachment
The basic PHP mail function is able to do option a) very easy, and every next option is only slightly more complicated.
Thanks Luuk, been quite a while, i have been really busy. I opted against using PHPmailer because i heard that it is always meddled with complications. A friend suggested another third party email system. sendgrid.com . I signed up,looked up the documentation and looked at their integration with Open Source apps(PHP in this case). I worked with this code -
require_once("../zoomie_files/includes/sendgrid/smtpapi-php.php");
-
-
use Smtpapi\Header;
-
-
$transport = \Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 587);
-
$transport->setUsername('sendgrid_username');
-
$transport->setPassword('sendgrid_password');
-
-
$mailer = \Swift_Mailer::newInstance($transport);
-
-
$message = new \Swift_Message();
-
$message->setTos(array('send_to@gmail.com'));
-
$message->setFrom('sent_from@gmail.com');
-
$message->setSubject('Hello');
-
$message->setBody('%how% are you doing?');
-
-
$header = new Header();
-
$header->addSubstitution('%how%', array('Owl'));
-
-
$message_headers = $message->getHeaders();
-
$message_headers->addTextHeader(HEADER::NAME, $header->jsonString());
-
-
try {
-
$response = $mailer->send($message);
-
print_r($response);
-
} catch(\Swift_TransportException $e) {
-
print_r('Bad username / password');
-
}
-
-
It gave me some errors wherever the "\" appeared. That is not a filepath seperator ryt? For windows, its "/". Its triggering errors. Please what does the "\" mean?
This is the first error statement
"Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in C:\wamp\www\btb_sandbox\sendemail7.php on line 7"
In -
-
use Smtpapi\Header; //There is actually a php file titled 'Header' in a folder named 'Smtpapi'.
-
//Is this an attempt to locate the file 'Header'?
-
These are other cases where the "\" appeared.
-
*** $transport = \Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 587);
-
** $mailer = \Swift_Mailer::newInstance($transport);
-
* $message = new \Swift_Message();
-
-
What do you think is wrong? What is the '\' sign for? Thanks for your help, i really appreciate. Thanks
Thanks Luuk. I upgraded to 5.5 and its giving me this error.
Fatal error: Class 'Swift_SmtpTransport' not found in C:\wamp\www\btb_sandbox\sendemail8.php on line 8
What do you think is the problem this time around? Thanks Luuk, you have been helpful.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: oopsbabies |
last post by:
Hello everyone,
I am using Apache 1.3.33 as the web server and PHP version 4.3.10. My
machine is using Windows XP 2002 professional edition which comes with
a Windows firewall. I am using McAfee...
|
by: dlite922 |
last post by:
I can't seem to get it working with my smtp server.
I can send the email through the command line like so:
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Wed, 6 Aug 2008 18:44:29...
|
by: mikek12004 |
last post by:
Before posting here I google it and saw ablut 30 pages for a solution so I pretty much excluded the obvious things. The code is
<?php
//now to send the mails to seller...
|
by: vivekgs2007 |
last post by:
HI to all,
I downloaded the Php Mailer Function, I embedded it to my Feedback page, It is not giving any error, But the mail is not going, I don't no where i gone wrong...Please help me...
|
by: Rekha Kumaran |
last post by:
I downloaded phpmailer-0.9.zip.
I added below 2 lines in php.ini.
include_path="/home/rose/phpmailer/phpmailer.inc.php"
include_path="/home/rose/phpmailer/smtp.inc.php"
If i run the below...
|
by: harini0590 |
last post by:
<?php
//this is a path to PHP mailer class you have dowloaded
include("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
|
by: shyqyri |
last post by:
Hello,
i have one website in php, but i have one module to send newslater to my subscribe. i have VPS server for unlimited email sending. but i have one problem, i have 24.000 email in my database...
|
by: afroz ahmad |
last post by:
i am trying to send multiple mail using phpmailer. I have a problem. When i click send button, just zxc@gmail.com and abc@yahoo.com receives the message.
How to change it? I'm use Gmail SMTP send...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |