I have the following configuration file. <?php define("HOST", "localhost"); define("PORT", 3306); define("USER", "xxx123"); define("PASS", "xyz456"); define("DB", "jobs"); define("smptserver",'smtpserver'); define("supportemail",'emailadress'); define("bcc",'emailaddress'); ?> Code (markup): (This is from Job Recruitment system by the way.) What do I write for 'smtpserver'? Yeah, I know, this is an amateur question, but I'm totally confused ...
The (Simple Mail Transport Protocol) SMTP Server is the mail server which is used to send out the email. If you are hosting this on your website, it would most probably be 'mail.yoursite.com' or 'smtp.yoursite.com'.
<?php // path to 'MAIL.php' file from XPM4 package require_once '/path-to/MAIL.php'; $m = new MAIL; // initialize MAIL class $m->From('username@gmail.com'); // set From mail address $m->AddTo('client@destination.net'); // add To mail address $m->Subject('Hello World!'); // set your mail subject // set your mail message (text/html) $m->Html('<b>HTML</b> <u>message</u>.'); // connect to MTA server 'smtp.gmail.com' port '465' via SSL ('tls' encryption) // with authentication: 'username@gmail.com' and 'password' // set the connection timeout to 10 seconds, the name of your // host 'localhost' and the authentication method to 'plain' // make sure you have OpenSSL module (extension) enable on your php configuration $c = $m->Connect('smtp.gmail.com', 465, 'username@gmail.com', 'password', 'tls', 10, 'localhost', null, 'plain') or die(print_r($m->Result)); // send mail relay using the '$c' resource connection echo $m->Send($c) ? 'Mail sent !' : 'Error !'; // disconnect from server $m->Disconnect(); ?> PHP: