Today i’ve spent the better part of the day trying to figure out why I cannot send out automated emails based on a Visualforce Email template. When I tried to send out the Email Template from some Scheduled Batch code, I’d recieve the following error message:
System.EmailException: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: Argument Error: Parameter value is null: 
After viewing a few forum posts and doing some of my own experimentation, I’ve found out at least 2 things that can give you this error.
These tags must be replaced with the standard HTML
<img> tags. This is pretty straight forward, as most
<apex:image> attributes correlate directly to an
<img> attribute and don’t need to be touched. The
styleClass can be replaced with
class attributes, respectively.
The only tricky attribute is probably the
rendered attribute. You could try to map this
style and put in a clever VF formula which could evaluate to
display:inline, but that CSS may not be supported by your email client. (Outlook 2007/2010 doesn’t. *sigh* Look here for more info on the differences between email client CSS support.)
A solution that works is to wrap the
<img> tag in a
<apex:outputPanel> tag and apply the
rendered expression to this tag.
This tag also needs to be replaced with the HTML
<a> anchor tag. Again, the conversion is fairly straight forward. The tricky attributes are
disabled. Again, I think
<apex:outputPanel> tags and some CSS styling can be used to do the same things.
Hopefully this saves someone the grief and hair-pulling I went through.