0

Hello ASP.NET programmers;

I've been searching for solutions for Mailing using Gmail not just text but also with attachments.

This code may help but I don't know what language they use to this:

/* yahoo */
public bool SendYahooMail(string sToEmail, string sFromEmail, string sHeader, string sMessage,string Password)
{
    SmtpClient client = new SmtpClient();
    client.DeliveryMethod = SmtpDeliveryMethod.Network;
    client.EnableSsl = true;
    client.Host = "smtp.mail.yahoo.co.in";
    client.Port = 587;
    // setup Smtp authentication
    System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(sFromEmail, Password);
    client.UseDefaultCredentials = false;
    client.Credentials = credentials;
    System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
    msg.From = new MailAddress(sFromEmail);
    msg.To.Add(new MailAddress(sToEmail));
    msg.Subject = sHeader;
    msg.IsBodyHtml = true;
    msg.Body = string.Format(sMessage);
    try
    {
        client.Send(msg);
        return true;
    }
    catch (Exception ex)
    {
        return false;            
    }
}
/* Gmail*/
public bool SendGmailMail(string sToEmail, string sFromEmail, string sHeader, string sMessage,string Password)
{
    SmtpClient client = new SmtpClient();
    client.DeliveryMethod = SmtpDeliveryMethod.Network;
    client.EnableSsl = true;
    client.Host = "smtp.gmail.com";
    client.Port = 587;
    // setup Smtp authentication
    System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(sFromEmail, Password);
    client.UseDefaultCredentials = false;
    client.Credentials = credentials;
    System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
    msg.From = new MailAddress(sFromEmail);
    msg.To.Add(new MailAddress(sToEmail));
    msg.Subject = sHeader;
    msg.IsBodyHtml = true;
    msg.Body = string.Format(sMessage);
    try
    {
        client.Send(msg);
        return true;
    }
    catch (Exception ex)
    {
        return false;            
    }
}
//

Please guide me using ASP.NET and C# as they related.

and also please help me about the FTP server which is hard for me to understand (like filezilla?).

do I need free hosting for this Project?

Can this Auto Mail be done using ASP.NET and C#?

-Zelrick

3
Contributors
8
Replies
37
Views
2 Years
Discussion Span
Last Post by Hasteral
0

The code you are showing is C#. Try to explain your problem in detail. You are asking five questions at once, without any specifics.

0

Hi Sir pritaeas;

I was trying to create an auto mail by google accnts, I saw some topic that can mail manually and no attachments.

I can display images in my sample program, using somee.com but now I can't I think somee is a trial version.

Can help me build ideas how to make this? using ASP.NET and C#? or It can be done by VB.NET?

0

What do you mean by "auto mail"?

I think somee is a trial version.

Check with somee, I don't know what kind of hosting you have.

0

Hi Sir pritaeas;

It is like mailing a pictures automatically to certain Gmail Accounts.

Can this be done if I use C# alone?

For example:

This folder contains 60 below images.

The whole picture inside the folder will be sent to gmail automatically.

Is it possible?

-Zelrick

0

Hello Sir pritaeas;

I just need to add

msg.Attachments.Add("path/to/your/image.ext");

to my code in C#? then can work even no GUI?

the automation can be done also?

-Zelrick

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.