The name of the variable is owner_email, you can see it if you examine the different provisioning dialogs.
Methods /ManageIQ/Infrastructure/VM/Provisioning/Email/MiqProvisionRequest_Pending and /ManageIQ/Infrastructure/VM/Provisioning/Email/MiqProvisionRequest_Approved use the requester’s address to send out emails and the instance’s attribute to_email_address
as a fallback, examine the code and you’ll see:
to ||= requester_email
# If to is still nil use to_email_address from model
to ||= $evm.object['to_email_address']
/ManageIQ/Infrastructure/VM/Provisioning/Email/MiqProvision_Complete works differently, will send out email to the address of the owner of the VM fetched from VMDB (that might be different than the requester). If not found, will send out to the value set in the instance’s attribute to_email_address
:
# Get VM Owner Name and Email
evm_owner_id = vm.attributes['evm_owner_id']
owner = nil
owner = $evm.vmdb('user', evm_owner_id) unless evm_owner_id.nil?
$evm.log("info", "VM Owner: #{owner.inspect}")
to = nil
to = owner.email unless owner.nil?
to ||= $evm.object['to_email_address']
If you want to change this behavior, you can copy these methods and make them use owner_email
field. The first two methods loads it with
owner_email = miq_request.options[:owner_email] || nil
HTH