May 25, 2011

Sending an email with embedded images using WhizBase

WhizBase has a built-in functions for sending a rich-text (HTML) emails. In your email you can easily include an absolute URL to any image and/or multimedia contents located on your server, but if you do that, in most cases the recipient will not see them automatically (security measure). To avoid this you should embed the images and other multimedia files in the body of your email. Embedding files using WhizBase is a simple task.
To illustrate this we will create a simple email template:
File email.wbsp
<!--
[FormFields]
WB_command=P
WB_mailserver=mail.whizbase.com
WB_from=admin@whizbase.com
WB_to=$wbv{email}
WB_mailauth=L
WB_mailuser=someuser
WB_mailpass=somepass
-->
<!--WB_BeginTemplate-->
<html>
<body>
<img src="http://www.whizbase.com/images/logo.jpg"><br>
Thank you for subscribing with us!<br>
</body>
</html>


This WBSP code will send an email that will not show the logo image to the recipient automatically. Now we will do few modifications to embed the logo.jpg to our email:
File emailembed.wbsp
<!--
[FormFields]
WB_command=P
WB_mailserver=mail.whizbase.com
WB_from=admin@whizbase.com
WB_to=$wbv{email}
WB_mailauth=L
WB_mailuser=someuser
WB_mailpass=somepass
WB_embed=/images/logo.jpg
-->
<!--WB_BeginTemplate-->
<html>
<body>
<img src="$wbcid[/images/logo.jpg]"><br>
Thank you for subscribing with us!<br>
</body>
</html>

As you can see we just added a WB_embed variable to include the file /images/logo.jpg in the body of the email message (MIME encoded) and changed the reference to file logo.jpg to use embedded image using WB function $WBCID.

4 comments:

Roy Cortez said...

Thanks.
^_^

Alizo Writero said...

Wonderful illustrated information. I thank you about that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject! Visit: : This Email Site

Mathu said...

Here's a complete guide on how to login into your Hotmail account. How to login into @hotmail.com account.

Sasha Smith said...

Thanks for sharing the post with us but does it also works with the ymail?