Send outlook mail from PHP script using COM objects
Posted: Sat Jul 25, 2009 3:56 pm
Hello Everyone,
My name is Richard, I am new to PHP programing and I am in need of some help. I am working on a PHP project that needs to parse an e-mail template pull out key words to be replaced by information from an HTML form and then create a
an email to be sent via outlook. I created the code to parse the template:
can anyone help me with the COM object? I know how to create the Object but I don't know what methods to use.
Thank you in advance Richard.
My name is Richard, I am new to PHP programing and I am in need of some help. I am working on a PHP project that needs to parse an e-mail template pull out key words to be replaced by information from an HTML form and then create a
an email to be sent via outlook. I created the code to parse the template:
Code: Select all
class Parser
{
// This Method will: 1. Get the content of a file and convert it to a string
// 2. Replace all the carriege return on the string with spaces
// 3. Use the spaces to split the string in to an array
// 4. compair the array elements to a patern and fine match
// 5. store match on a seperate array.
public function get_field($file){
$Mail_Text = file_get_content($file);
$Patern = '/^_[INSERT]{6}+[_A-Z]+[_A-Z]_$/';
$File_Content = str_replace(chr(13), chr(32), $Mail_Text);
$aField_Content = explode(chr(32),$File_Content);
foreach($aField_Content as $Element){
if (preg_match($Patern,$Element){
$aField[].=$Element;
}
}
}
return true;
}
Thank you in advance Richard.