php - Send email via Outlook. I want to pick my own "to" receivers -
i have small php script (shown below) "automatically" emails simple test message whichever email address in $to variable e.g. username@email.com
$subject="this test message"; $message='this <font color="red">body</font> section'; $to="username@email.com"; // starting outlook com_load_typelib("outlook.application"); if (!defined("olmailitem")) {define("olmailitem",0);} $outlook_obj = new com("outlook.application") or die("unable start outlook"); $omsg = $outlook_obj->createitem(olmailitem); $omsg->recipients->add($to); $omsg->subject=$subject; $omsg->htmlbody=$message; $omsg->save(); $omsg->send();
the script works great, except don't want automatically send out email.
i want load email outlook , allow me manually add email addresses.
however, if leave $to variable blank (i.e. "") or remove "$omsg->recipients->add($to);" line error message.
does guru know of solution or going stuck php automatically sending out emails.
i need manually able send out email email addresses can vary, , might want add line of 2 @ bottom of email.
any ideas?
many thanks,
pete
Comments
Post a Comment