Error with SMTP

N

NishWishs

iam trying to send the comments from my application to my email using
smtp
and code i written is
protected void Wizard1_FinishButtonClick(object sender,
WizardNavigationEventArgs e)
{
SendMail(emailTB.Text, commentsTB.Text);
}
private void SendMail(string from, string body)
{
string mailServerName = "SMTP.google.com";
MailMessage message = new MailMessage(from,
"(e-mail address removed)", "feedback", body);
SmtpClient mailClient = new SmtpClient();
mailClient.Host = mailServerName;
mailClient.Send(message);
message.Dispose();
}
but iam getting following error plz help

Mailbox unavailable. The server response was: 5.7.1
<[email protected]>... Relaying denied
 
N

NishWishs

Download my sample codehttp://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
at this URL.

I have 1.1 and 2.0 examples with gmail (google) settings.

Leave a "thank you" comment!

SIr,
iam trying to send an email using an wizard, iam unable to understand
ur code sir.
onething is that i didn`t changed web.config file

protected void Wizard1_FinishButtonClick(object sender,
WizardNavigationEventArgs e)
{
SendMail(emailTB.Text, commentsTB.Text);
}
private void SendMail(string from, string body)
{
string mailServerName = "smtp.google.com";
MailMessage message = new MailMessage(from,
"(e-mail address removed)", "feedback", body);
//SmtpClient client = new SmtpClient(server, port);
SmtpClient mailClient = new SmtpClient("SMTPserver",25);
mailClient.Host = mailServerName;
mailClient.Credentials =
CredentialCache.DefaultNetworkCredentials;

mailClient.Send(message);
message.Dispose();
}
}

it takes from address from the wizard sir.
could u plz explain me wat to change in web.config file
 
S

sloan

The best thing to do is download my sample.

Compile it and run it.

You'll need to change some of the config settings to match your setup.

Do you have a gmail account? That would be question #1.


<!--Note, with the 2.0 Framework, my tests show that gmail likes port 587-->

<smtpServer enabled="true" smtpServerName="smtp.gmail.com"
defaultEmailFrom="(e-mail address removed)" portNumber="465"
authenicationMode="SSL" smtpUserName="(e-mail address removed)"
smtpUserPassword="mygmailpassword_I_do_not_Know_Your_password"
executeOrder="3"/>

set the other entries to:
enabled="false"

You may need to change the port number.

The downloadable code works. And you should READ MY ARTICLE that
accompanies the downloadable code instead of just trying to run the
code.......
The article explains what you need to change.


I cannot just say "do this or do that" to your code. Especially since I've
already done the work already. My downloadable code works with gmail, so
its easier to just start there instead of trying to find what is missing.

1.1 is different from 2.0 as well.






Download my sample
codehttp://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
at this URL.

I have 1.1 and 2.0 examples with gmail (google) settings.

Leave a "thank you" comment!

SIr,
iam trying to send an email using an wizard, iam unable to understand
ur code sir.
onething is that i didn`t changed web.config file

protected void Wizard1_FinishButtonClick(object sender,
WizardNavigationEventArgs e)
{
SendMail(emailTB.Text, commentsTB.Text);
}
private void SendMail(string from, string body)
{
string mailServerName = "smtp.google.com";
MailMessage message = new MailMessage(from,
"(e-mail address removed)", "feedback", body);
//SmtpClient client = new SmtpClient(server, port);
SmtpClient mailClient = new SmtpClient("SMTPserver",25);
mailClient.Host = mailServerName;
mailClient.Credentials =
CredentialCache.DefaultNetworkCredentials;

mailClient.Send(message);
message.Dispose();
}
}

it takes from address from the wizard sir.
could u plz explain me wat to change in web.config file
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top