PDA

View Full Version : MailDefinition from .cs file


QBall777
05-27-2009, 02:19 PM
Hi I'm having some trouble with the code below.

I know how the MailDefination works in Wizard control but I'm unsure in the code behind.

This is my effort.


// send the mail

MailDefinition msg = new MailDefinition();

msg.BodyFileName = @"~/EmailTemplates/OrderMail.html";

msg.IsBodyHtml = true;

msg.CC = "bob@rererere.co.uk";


//if (!string.IsNullOrEmpty(Globals.Settings.ContactForm.MailCC))

// msg.CC.Add(new MailAddress(Globals.Settings.ContactForm.MailCC));

msg.Subject = "Order From Webbs Training";


new SmtpClient().Send(msg);

I'm not getting an error it's just not sending:

this line is wrong (new SmtpClient().Send(msg);)

Can anyone see were i'm going wrong?
Thanks