Hi,
Im trying to send mail from asp.net page to gmail account.
Im trying to do this with the help of below code, but cant archive
it.
MailMessage message = new MailMessage("xxx@gmal.com", "xxx@gmal.com",
"xxx@gmal.com", "xxx@gmal.com");
SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
smtp.Send(message);
The above code doesn't seem to work..
Please help
Newbie Coder - 24 Nov 2007 19:03 GMT
Jack,
Ports 465/995 are secure in Gmail. There is a free SSL library which Gmail use for their
Gmail e-mail tool. See below:
http://www.mentalis.org/soft/projects/ssocket/

Signature
Newbie Coder
(It's just a name)
> Hi,
> Im trying to send mail from asp.net page to gmail account.
[quoted text clipped - 9 lines]
>
> Please help
Mark Rae [MVP] - 24 Nov 2007 19:07 GMT
> Im trying to send mail from asp.net page to gmail account.
> Im trying to do this with the help of below code, but cant archive
[quoted text clipped - 5 lines]
>
> The above code doesn't seem to work..
There are several things here:
1) You don't need to use GMail as the relay server just because you want to
send email *to* a Gmail account...
2) What you mean by "can't archive it"? What archive are you talking
about...?
3) The MailMessage() object declaration is incorrect:
http://www.systemnetmail.com/faq/3.1.1.aspx

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Peter Bromberg [C# MVP] - 24 Nov 2007 23:21 GMT
Here is sample working Gmail Sender code. Watch carefully at everything that
is done:
using System;
using System.Collections.Generic;
using System.Text;
namespace PAB.Utils
{
public static class Sender
{
public static void SendGmail(string userName, string password,
string mailFrom,
string mailTo,string subject, string
message,bool isBodyHtml)
{
System.Net.Mail.MailMessage msg = new
System.Net.Mail.MailMessage(mailFrom,mailTo,
subject, message);
msg.IsBodyHtml = isBodyHtml;
System.Net.NetworkCredential cred = new
System.Net.NetworkCredential(userName, password);
System.Net.Mail.SmtpClient mailClient = new
System.Net.Mail.SmtpClient("smtp.gmail.com",587);
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = cred;
mailClient.Send(msg);
}
}
}

Signature
--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com
> Hi,
> Im trying to send mail from asp.net page to gmail account.
[quoted text clipped - 9 lines]
>
> Please help
shobaguna - 08 Feb 2008 19:39 GMT
> Here is sample working Gmail Sender code. Watch carefully at everything that
> is done:
[quoted text clipped - 41 lines]
> >
> > Please help
Henk Kelder - 25 Nov 2007 13:38 GMT
You should not send your message to gmail directly.
Instead, use the SMTP server that belongs to your domain/internet provider.
> Hi,
> Im trying to send mail from asp.net page to gmail account.
[quoted text clipped - 9 lines]
>
> Please help
sloan - 25 Nov 2007 20:15 GMT
I have a gmail example wired up (downloadable code) at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
> Hi,
> Im trying to send mail from asp.net page to gmail account.
[quoted text clipped - 9 lines]
>
> Please help
jack - 27 Nov 2007 18:14 GMT
Thanks all it worked
have created a small application which sends the mail.
shobaguna - 08 Feb 2008 19:42 GMT
i want to send a msge to 247chat@gmail.com
> Thanks all it worked
>
> have created a small application which sends the mail.
George Ter-Saakov - 08 Feb 2008 19:50 GMT
I want a lot of thing but I do not post them all here :)
If you have a question then ask and do not forget to provide specific
problem you face with descriptive error you get (if any)
George.
>i want to send a msge to 247chat@gmail.com
>
>> Thanks all it worked
>>
>> have created a small application which sends the mail.