Simply getting "Failure to send email"

Discussion in 'Email' started by thephoenix007, Sep 13, 2015.

  1. public Emailer(User user)
    this.User = user;
    this.Client = new SmtpClient("");
    this.Client.UseDefaultCredentials = false;


    public string SendActivationEmail()
    this.Client.Credentials = new NetworkCredential("UserRegistration", "password");
    MailDefinition md = new MailDefinition();
    md.From = "";
    md.Subject = string.Format("{0}, Welcome to! Please activate your account.", this.User.UserName);
    md.IsBodyHtml = true;
    md.BodyFileName = "~/Utilities/Email/EmailConfirmationTemplate.html";
    md.EmbeddedObjects.Add(new EmbeddedMailObject("Background", "~/Content/Images/BGPlanet.jpg"));
    md.EmbeddedObjects.Add(new EmbeddedMailObject("Logo", "~/Content/Images/logo.png"));

    ListDictionary replacements = new ListDictionary();
    replacements.Add("{username}", User.UserName);
    replacements.Add("{guid}", User.ConfirmationGuid.ToString());
    replacements.Add("{benderquote}", Fun.GenerateBenderQuote());

    MailMessage message = md.CreateMailMessage("", replacements, new System.Web.UI.Control());

    return string.Empty;
    catch (Exception ex)
    return ex.Message;

    So This code works, right up to Client.Send(message); After about 20 seconds I get. "Failure to send message". No exceptions thrown.

    Any Help?

Share This Page