Emails sent with "no subject"

Discussion in 'Email' started by cer9sss, Jun 3, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi everyone,

    I've developed a MVC application that it's running on my discountaspnet host, it has the functionality for email sending which I've already tested on my own development and testing environments and it's working properly.

    All of the emails that are sent from my application include a subject. Otherwise, everytime I send emails from the discountaspnet host, they're received with the text "no subject" as subject.

    My method is very simple. Here it is

    public static int SendEmail(string host, string from, string to, string subject, string body, bool isBodyHtml)
    {

    try
    {
    MailMessage mail = new MailMessage(from, to);
    mail.IsBodyHtml = isBodyHtml;
    mail.Priority = MailPriority.Normal;
    mail.Body = body;

    SmtpClient mstpClient = new SmtpClient(host);
    mstpClient.Send(mail);
    return 1;
    }
    catch (Exception ex)
    {
    return -1;
    }

    }


    Which could be the reason of this issue?

    Thanks
     
  2. Hi,
    Add:
    mail.Subject = "testing...";
     
  3. Thanks wisemx, it seems that you're right. It's a little bit weird that I didn't see this. I've tons of code and I didn't realized that on the most basic part I had omitted the subject. Sometimes we need of somebody else to see this kind of things. I don't have my application overhere, but I'll see later if this solves my problem, I'll be posting it here.

    Thanks
     
  4. wisemx that was the problem. Thanks!
     
  5. mjp

    mjp

    wisemx strikes again!
     
  6. ...For a Harley building unicycle riding nut I do alright once in awhile. lol
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page