Click here to Skip to main content
15,798,592 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: License key for Visual studio 2005 Pin
N a v a n e e t h6-Nov-09 4:44
N a v a n e e t h6-Nov-09 4:44 
AnswerRe: License key for Visual studio 2005 Pin
Christian Graus6-Nov-09 12:48
protectorChristian Graus6-Nov-09 12:48 
Question'Lucida Console' with 'US-ASCII' is not recognized. error in asp.net using itext sharp Pin
trilokharry6-Nov-09 3:06
trilokharry6-Nov-09 3:06 
Questionweb-based payments processing system like e-shoping. Pin
Saam_cse6-Nov-09 2:53
Saam_cse6-Nov-09 2:53 
AnswerRe: web-based payments processing system like e-shoping. Pin
Gamzun6-Nov-09 22:17
Gamzun6-Nov-09 22:17 
QuestionSend mail with smtp server Pin
ankur10876-Nov-09 2:53
ankur10876-Nov-09 2:53 
AnswerRe: Send mail with smtp server Pin
Ashfield6-Nov-09 3:12
Ashfield6-Nov-09 3:12 
AnswerRe: Send mail with smtp server Pin
OriginalGriff6-Nov-09 7:13
mvaOriginalGriff6-Nov-09 7:13 
Here is the routine I use:
/// <summary>
/// Send an email to the user.
/// </summary>
/// <param name="mu">User to send email to</param>
/// <param name="body">Text to send</param>
/// <param name="subject">Seubject line</param>
/// <param name="from">Subaccount to send from. If null or empty, NoReply will be used.</param>
public static void SendUserEmail(MembershipUser mu, string body, string subject, string from)
    {
    if (string.IsNullOrEmpty(from))
        {
        from = "NoReply";
        }
    try
        {
        MailMessage mail = new MailMessage();
        mail.Body = body;
        mail.IsBodyHtml = true;
        mail.To.Add(new MailAddress(mu.Email));
        mail.From = new MailAddress(from + strEmailAccountBase, from + strEmailAccountBase, Encoding.UTF8);
        mail.Subject = subject;
        mail.SubjectEncoding = Encoding.UTF8;
        mail.Priority = MailPriority.Normal;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = ConfigurationManager.ConnectionStrings["EmailProvider"].ConnectionString;
        NetworkCredential nc = GetEmailCredentials();
        if (nc != null)
            {
            smtp.Credentials = nc;
            }
        else
            {
            }
        smtp.Send(mail);
        }
    catch (Exception ex)
        {
        throw new ApplicationException("Could not send email", ex);
        }
    }


Your web.config connection string entry should be along the lines of:
<add name="EmailProvider" connectionString="smtp.YOURMAILPROVIDER.COM"/>


GetEmailCredentials you will have to write yourself; if your host does not require credentials then just return null.

No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

Questionrefresh Pin
AndyInUK6-Nov-09 2:16
AndyInUK6-Nov-09 2:16 
AnswerRe: refresh Pin
sashidhar6-Nov-09 2:23
sashidhar6-Nov-09 2:23 
QuestionProblem in Table Designing Pin
rhtbhegade6-Nov-09 1:24
rhtbhegade6-Nov-09 1:24 
AnswerRe: Problem in Table Designing [modified] Pin
compninja256-Nov-09 2:51
compninja256-Nov-09 2:51 
GeneralRe: Problem in Table Designing Pin
rhtbhegade6-Nov-09 18:51
rhtbhegade6-Nov-09 18:51 
GeneralRe: Problem in Table Designing Pin
sashidhar6-Nov-09 20:07
sashidhar6-Nov-09 20:07 
QuestionScript function is not working. Pin
bhavnvyas6-Nov-09 0:49
bhavnvyas6-Nov-09 0:49 
AnswerRe: Script function is not working. Pin
sashidhar6-Nov-09 1:04
sashidhar6-Nov-09 1:04 
GeneralRe: Script function is not working. Pin
bhavnvyas6-Nov-09 1:15
bhavnvyas6-Nov-09 1:15 
GeneralRe: Script function is not working. Pin
sashidhar6-Nov-09 1:19
sashidhar6-Nov-09 1:19 
GeneralRe: Script function is not working. Pin
bhavnvyas6-Nov-09 1:26
bhavnvyas6-Nov-09 1:26 
GeneralRe: Script function is not working. Pin
bhavnvyas6-Nov-09 1:36
bhavnvyas6-Nov-09 1:36 
GeneralRe: Script function is not working. Pin
sashidhar6-Nov-09 1:44
sashidhar6-Nov-09 1:44 
GeneralRe: Script function is not working. Pin
bhavnvyas6-Nov-09 1:48
bhavnvyas6-Nov-09 1:48 
GeneralRe: Script function is not working. Pin
sashidhar6-Nov-09 1:51
sashidhar6-Nov-09 1:51 
GeneralRe: Script function is not working. Pin
bhavnvyas6-Nov-09 1:53
bhavnvyas6-Nov-09 1:53 
GeneralRe: Script function is not working. Pin
sashidhar6-Nov-09 2:07
sashidhar6-Nov-09 2:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.