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 .= "[email protected]"; $headers["From"] = "Me <[email protected]>"; $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.'); ?> 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? 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. 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. Link to comment https://forums.phpfreaks.com/topic/171645-solved-define/#findComment-905105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.