Q:

Magento: Custom Welcome Email Template Based On Account Information

I'm on Magento CE 1.8.1 and I'm trying to figure out a way to send a custom welcome email template when an account is created from the backend with the "Send Welcome Email" checked based on customer information.
For example, we have this custom field on accounts called Sales Rep:

Using that, we'd like to create a custom email template for each of our sales reps when they sign a customer up from the backend... if no Sales Rep is added, then it just sends the default template.
Not sure what models / files I should be looking at here, but found this bit of code and thought it might be a starting place?
app/code/core/Mage/Adminhtml/controllers/CustomerController.php
// Send welcome email
            if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
                $storeId = $customer->getSendemailStoreId();
                if ($isNewCustomer) {
                    $customer->sendNewAccountEmail('registered', '', $storeId);
                } elseif ((!$customer->getConfirmation())) {
                    // Confirm not confirmed customer
                    $customer->sendNewAccountEmail('confirmed', '', $storeId);
                }
            }

Any help is much appreciated!

A:

I figured this out by adding a phtml block to my email template:
{{block type='core/template' area='frontend' template='mycompany/email/salesrep.phtml' customer=$customer}}

And then I created the block in the following directory:
/app/design/frontend/MyCompany/MyTheme/template/mycompany/email/
Here's the file I used to determine what information to send in the email based on the customer's sales rep field:
salesrep.phtml
<?php 
$customer = $this->getCustomer();
$salesrep = $customer->getSalesrep(); 

if (stripos($salesrep, "sales rep 1") !== false) {
    echo "Your Account Rep is <strong>Sales Rep 1</strong>"; //whatever info here
}
if (stripos($salesrep, "sales rep 2") !== false) {
    echo "Your Account Rep is <strong>Sales Rep 2</strong>"; //whatever info here
}

?>

And here is the final result in the email:

