Friday, January 2, 2009

Send Email from ASP.NET usign GMAIL Account

protected void Page_Load(object sender, EventArgs e)
{
SendMail("smtp.gmail.com",
465,
"account@gmail.com",
"<accountpassword>",
"Your name",
"account@gmail.com",
"Stefan Receiver",
"receive@whatever.com",
"Test",
"Hello there Steff!",
true);
}
public static void SendMail(string sHost, int nPort, string sUserName, string sPassword, string sFromName, string sFromEmail,
string sToName, string sToEmail, string sHeader, string sMessage, bool fSSL)
{
if (sToName.Length == 0)
sToName = sToEmail;
if (sFromName.Length == 0)
sFromName = sFromEmail;

    System.Web.Mail.MailMessage Mail = new System.Web.Mail.MailMessage();
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = sHost;
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
    Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = nPort.ToString();
if (fSSL)
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpusessl"] = "true";

    if (sUserName.Length == 0)
{
//Ingen auth
}
else
{
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = sUserName;
Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = sPassword;
}

    Mail.To = sToEmail;
Mail.From = sFromEmail;
Mail.Subject = sHeader;
Mail.Body = sMessage;
Mail.BodyFormat = System.Web.Mail.MailFormat.Html;

    System.Web.Mail.SmtpMail.SmtpServer = sHost;
System.Web.Mail.SmtpMail.Send(Mail);
}

Thursday, January 1, 2009

Grey-out html page and pop-up a interactive dialog box

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function showPopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "block"
dlg.style.display = "block"
if (document.body.style.overflow = "hidden") {
cvr.style.width = "1024"
cvr.style.height = "100%"
}
}
function closePopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
document.body.style.overflowY = "scroll"
}
</script>
<style type="text/css">
#cover {
display:none;
position:absolute;
left:0px;
top:0px;
width:100%;
height:100%;
background:gray;
filter:alpha(Opacity=50);
opacity:0.5;
-moz-opacity:0.5;
-khtml-opacity:0.5
}
#dialog {
display:none;
left:200px;
top:200px;
width:300px;
height:300px;
position:absolute;
z-index:100;
background:white;
padding:2px;
font:10pt tahoma;
border:1px solid gray
}
</style>
</head>
<body>
<div id="cover"></div>
<div id="dialog">
My Dialog Content
<br><input type="text">
<br><input type="button" value="Submit">
<br><a href="#" onclick="closePopUp('dialog');">[Close]</a>
</div>
<a href="#" onclick="showPopUp('dialog');">Show</a>
</body>
</html>

Happy New Year 2009

Tuesday, October 7, 2008

A to Z for Life

A.
Avoid negative people, negative habits and negative sources of information.
B.
Believe in yourself and your closest confidants.
C.
Create a healthy balance between career, family and social responsibilities.
D.
Dare to be unique and creative.
E.
Enjoy yourself everyday. It’s quite possible there will be no tomorrow.
F.
Find what you love and become an expert at it.
G.
Go the extra mile. A little extra effort separates the good from the great.
H.
Help others when given the chance.
I.
Ignore insults, but take heed to constructive criticism.
J.
Just do it. Action is the vehicle for success.
K.
Kindness always trumps intelligence in the long-term.
L.
Learn at least one practical lesson everyday.
M.
Manage your time effectively by prioritizing your obligations.
N.
Never lie. Never cheat. Never steal.
O.
Open your mind to fresh ideas and experiences.
P.
Practice. Practice. Practice.
Q.
Quitting is not an option. Don’t give up on something or someone you believe in.
R.
Read as much as you can as often as you can.
S.
Stop procrastinating. Stop ignoring unsettled problems.
T.
Take responsibility for your actions, the good and the bad.
U.
Use your natural talents to open new doors of opportunity.
b
Visualize your goals and map out an action plan for achieving them.
W.
Write stuff down.
X.
X-factors for success are always present. Keen awareness will uncover them.
Y.
You will never succeed if you never try.
Z.
Zero in on the truth by analyzing situations from every possible angle.

Sunday, October 5, 2008

Before and After

Before Marriage.....

He: Yes. At last. It was so hard to wait.
She: Do you want me to leave?
He: No! Don't even think about it.
She: Do you love me?
He: Of course! Over and over!
She: Have you ever cheated on me?
He: No! Why are you even asking?
She: Will you kiss me?
He: Every chance I get.
She: Will you hit me?
He: Are you crazy! I'm not that kind of person!
She: Can I trust you?
He: Yes.
She: Darling!
.
.
.
After Marriage....
Scroll up and Simply read from bottom to top.