sawade Posted August 24, 2009 Share Posted August 24, 2009 bool define ( string $name , mixed $value ) Is it possible to put SMTP values into an external php file and call on them? For example: <?php // Define Email constants define('STMP_HOST', 'localhost'); define('STMP_PORT', '26'); define('STMP_PASSWORD', 'password'); define('STMP_USERNAME', 'username'); ?> <?php /* Email */ require_once "Mail.php"; require_once "emailcontants.php"; $to = $_POST['email'] . ', ' ; $to .= "me@email.com"; $headers["From"] = "Me <me@email.com>"; $headers["Subject"] = "Email"; $smtp["host"] = STMP_HOST; $smtp["port"] = STMP_PORT; $smtp["auth"] = true; $smtp["username"] = STMP_USERNAME; $smtp["password"] = STMP_PASSWORD; $msg = "Hello!"; $msg = wordwrap($msg, 70); /* Sends Email */ $mail = Mail::factory('smtp', $smtp); $mail->send($to, $headers, $msg) or die('Error accessing SMTP server.'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/171645-solved-define/ Share on other sites More sharing options...
Mark Baker Posted August 24, 2009 Share Posted August 24, 2009 Why do you tink it might not be? and have you tried actually doing it? Quote Link to comment https://forums.phpfreaks.com/topic/171645-solved-define/#findComment-905073 Share on other sites More sharing options...
sawade Posted August 24, 2009 Author Share Posted August 24, 2009 Well I've never used define() and the only time I have practiced with it is for mysql connect constants. Wasnt' sure if it was only useable with mysql. And no I haven't tried it yet. I am working on another aspect of the code first before jumping headfirst into this. Quote Link to comment https://forums.phpfreaks.com/topic/171645-solved-define/#findComment-905091 Share on other sites More sharing options...
Mark Baker Posted August 24, 2009 Share Posted August 24, 2009 Wasnt' sure if it was only useable with mysql.define() is a PHP construct, not limited to any particular PHP modules. Quote Link to comment https://forums.phpfreaks.com/topic/171645-solved-define/#findComment-905105 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.