Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sending Mail from asp.net for Gmail ID

Reply
Thread Tools

Sending Mail from asp.net for Gmail ID

 
 
jack
Guest
Posts: n/a
 
      11-24-2007
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("", "",
"", "");
SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
smtp.Send(message);



The above code doesn't seem to work..

Please help
 
Reply With Quote
 
 
 
 
Newbie Coder
Guest
Posts: n/a
 
      11-24-2007
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/

--
Newbie Coder
(It's just a name)


"jack" <> wrote in message
news:5dce833b-9a32-4f17-8a7c-...
> 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("", "",
> "", "");
> SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
> smtp.Send(message);
>
>
>
> The above code doesn't seem to work..
>
> Please help


 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      11-24-2007
"jack" <> wrote in message
news:5dce833b-9a32-4f17-8a7c-...

> 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("", "",
> "", "");
> SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
> smtp.Send(message);
>
> 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


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      11-24-2007
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);
}
}
}
--
--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



"jack" wrote:

> 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("", "",
> "", "");
> SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
> smtp.Send(message);
>
>
>
> The above code doesn't seem to work..
>
> Please help
>

 
Reply With Quote
 
Henk Kelder
Guest
Posts: n/a
 
      11-25-2007
You should not send your message to gmail directly.

Instead, use the SMTP server that belongs to your domain/internet provider.





"jack" <> wrote in message
news:5dce833b-9a32-4f17-8a7c-...
> 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("", "",
> "", "");
> SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
> smtp.Send(message);
>
>
>
> The above code doesn't seem to work..
>
> Please help



 
Reply With Quote
 
sloan
Guest
Posts: n/a
 
      11-25-2007

I have a gmail example wired up (downloadable code) at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry




"jack" <> wrote in message
news:5dce833b-9a32-4f17-8a7c-...
> 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("", "",
> "", "");
> SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
> smtp.Send(message);
>
>
>
> The above code doesn't seem to work..
>
> Please help



 
Reply With Quote
 
jack
Guest
Posts: n/a
 
      11-27-2007
Thanks all it worked

have created a small application which sends the mail.

 
Reply With Quote
 
shobaguna
Guest
Posts: n/a
 
      02-08-2008


"Peter Bromberg [C# MVP]" wrote:

> 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);
> }
> }
> }
> --
> --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
>
>
>
> "jack" wrote:
>
> > 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("", "",
> > "", "");
> > SmtpClient smtp = new SmtpClient("smtp.gmail.com",465);
> > smtp.Send(message);
> >
> >
> >
> > The above code doesn't seem to work..
> >
> > Please help
> >

 
Reply With Quote
 
shobaguna
Guest
Posts: n/a
 
      02-08-2008
i want to send a msge to

"jack" wrote:

> Thanks all it worked
>
> have created a small application which sends the mail.
>
>

 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      02-08-2008
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.


"shobaguna" <> wrote in message
news:C6194EDB-4602-43B7-9442-...
>i want to send a msge to
>
> "jack" wrote:
>
>> Thanks all it worked
>>
>> have created a small application which sends the mail.
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems sending mail with gmail and SMTP Mikael H. Ruby 1 02-21-2011 03:50 PM
problem sending mail: Sending the email to the following server failed Luke Java 2 03-15-2007 10:54 AM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM
Gmail error sending mail to Microsoft. Waylon Kenning NZ Computing 18 09-26-2005 11:21 PM
Mail component to retrieve mail from Hotmail, Yahoo, gmail..etc? John Dalberg ASP .Net 1 09-19-2005 02:56 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57