A problem to send email using Smtp - I don't receive emails by sending emails using smtp

I have a proble to send an email from asp.net

I do the following code to send an email:
MailMessage mail=new MailMessage();
mail.From="test@server.com";
mail.To="myemailaddress@server.com";
mail.BodyFormat=MailFormat.Html;
mail.Subject="testing...";
mail.Body="cool";
SmtpMail.SmtpServer="localhost";
SmtpMail.Send(mail);
But I dont' receive an email when I use this method. Why is that? How can I send an email?
Thanks in advance!
-1
Plato2
1/31/2004 1:58:19 AM
asp.net.getting-started 91979 articles. 2 followers. Follow

8 Replies
840 Views

Similar Articles

[PageSpeed] 14

check and see if..

-your client-side code has no errors
-you imported the System.Web.Mail namespace
-your email is setup right
-your 'localhost' supports smtp..
hope this helps
"programming open-source is programming communism."
-1
lostincode
1/31/2004 3:27:04 AM
I checked IIS it looks like localhost supports smtp(there is a default smtp server?!).

What do you mean I should check if my email is setup right?
Any other ideas.
Thanks
-1
Plato2
1/31/2004 4:01:39 AM
hi , 

you have to set relay in your smtp server , or your smtp server requires username &
password when you are trying to send and emial with .net mail object .
do the following :
go to access tab of of your smtp server properties
on last section there is a relay button , click on it
check all expet the list below . (the list must be blank)
its done .
now check your application , it should work .
ps: im using windows xp , in other version of windows , u have to do the same thing .

1
ariya
1/31/2004 9:12:11 AM
Hi,

Take a look @ Complete FAQ for the System.Web.Mail namespace and view post 268037
HTH

K B Shajudeen
AreYaar.com
Dubai, United Arab Emirates.
1
Shaji
1/31/2004 9:37:49 AM
I did that and it still doesn't work! I opened Badmail folder and all my email are there with the message "Delivery to the following recipients failed."

Any Ideas what to do? Or is there is another way to send emails form asp.net?
Thanks
1
Plato2
1/31/2004 4:23:31 PM
Hi there,

I had the same problem to get my e-mails out to others.
In the end I resolved the problem by changing the SmtpMail.SmtpServer="localhost"; in:
SmtpMail.SmtpServer = Request.ServerVariables("SERVER_NAME").
Also I had to setup my "Default SMTP virtual Server" in IIS in this way:
Enter the IIS module and move to the Relay button in the Access part.
IIS
-<Your website>
--Default SMTP virtual Server -> properties
---TAB Access -> Relay....
----Add your IP adress in this window and Grant "only the list below" which contains your IPadress.
So, by putting the "Request.ServerVariables("SERVER_NAME")" in your code, and set up the proper relay in IIS, the problem was solved.
Success,
Happy programming.
Jos Richters
www.visualdata.nl
"He who pretends to know everything does't know much!" Keep on asking!
1
josrichters
1/31/2004 9:17:36 PM
I did that as you said but it still doesn't work?!?!?!?

Any ideas?
1
Plato2
2/1/2004 4:57:32 PM
When you put the "Request.ServerVariables("SERVER_NAME")"  in (for instance) your FROM field e.g. <MyName>@"Request.ServerVariables("SERVER_NAME")"  you shoud see the servername you are using. In my cas, this is my server's IP adress. So I made the IP adress in the relay-part of IIS exactly the same. Eventually this was the trick in my case. Otherwise you have to retrieve your server's IP adress elsewhere...

good luck!
Jos Richters
www.visualdata.nl
"He who pretends to know everything does't know much!" Keep on asking!
-1
JosRichters
2/2/2004 12:01:25 PM
Reply:

Similar Artilces:

multiple SMTP's and different IP's, domain names to send email from this server using different SMTP's
Is anybody can help me with this 2 issues we have: 1. We need to have multiple SMTP's installed on our server - how do you do that 2. We need to rotate different IP's, domain names to send email from this server using different SMTP's          Thanks   Third party mail server.  Look at Smartermail or iMail, Exchange if you need that much. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. Is this only option? &n...

hide email addresses from email after using smtp.send()
hello , I have some kind of subscribe feature , the emails are saved in database so am using a sqldatareader and a loop , inside loop am adding the emails with msg.to.add() , but what is happening that all the emails are being shown ( in the to place) when a subscriber receives an email , but I dont want that , cause the subscriber shall not know email addresses of other subscribers , how to fix this thing ?!? thanks alot place all the recipients on the BCC of the email. this prevents them from seeing the email of other BCC recipients  Mike Banavige~~~~~~~~~~~~Need...

Using Mozmill to send/receive emails account is configured using Thunderbird (IMAP & SMTP) server settings
Hi All, If the account is configured using (IMAP & SMTP) server settings how to send/receive email messages using Mozmill? I tried this example http://mxr.mozilla.org/comm-central/source/mail/test/mozmill/test-msg-content-policy.js and it looks good for a local account. -Kishore. Kishore Kumar, Koneti wrote: > If the account is configured using (IMAP & SMTP) server settings how to > send/receive email messages using Mozmill? For best reproducibility, you'll probably want to use the fakeserver utilities: <https://wiki.mozilla.org/MailNews:Fakeserver&g...

Two things,Why do I keep getting emails that I don't want. can't get rid of them? Why can't I get my email when I am out of town? Or can I?
Name: Ed Leech Email: ELCraftatzoominternetdotnet Product: Thunderbird Summary: Two things,Why do I keep getting emails that I don't want. can't get rid of them? Why can't I get my email when I am out of town? Or can I? Comments: I am getting frusted with all the emails coming in that I do not want, I am using the tools to get thme out but they keep coming. They just use different names or whatever. I have been thinking of just switching to something else but my business intrusts know this email and it is tooo confusing to change. Every time I go out of town on business I can get me emails. If I switch to yahoo.com I can get into yahoo from anywhere but not THunderbird.If I am wrong please let me know. Thanks Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 ...

Can't Send Email using Verizon Email with SM. OE6 works okay.
I am trying to setup SM 1.1.11 to work with Verizon email. Reading email works but sending does not. When I try to send with SM, I get the following: "Send Message Error. Sending of message failed. The message could not be because connecting to SMTP server outgoing.verizon.net failed. ...." I am able to get the send to work in OE6 with the following settings: OE6 Outgoing port = 25 "Server requires SSL" is not checked "Outgoing Server requires authentication" IS checked Settings "Use same settings as my incoming server" IS checked ...

strange problem when i send email using SMTP ?
I code : System.Web.Mail.MailMessage mymail=new MailMessage(); mymail.To="a@abc.mail"; mymail.From="a1@abc.com"; mymail.BodyFormat=MailFormat.Html; mymail.Subject="mysubject"; mymail.Body="<html><body><table border=2><tr><td><b>Test</b></td></tr></table></body></html>"; SmtpMail.SmtpServer="localhost"; SmtpMail.Send(mymail); I can not get the HTML format in mail !!!!! I use MDeamon 5.0 ! Help me !! thank you very much ! Try setting the SmtpServer to "" that's how I did it in the past. Now I've changed t...

There was an error sending mail from 'bugzilla maintainer email' to 'bugzilla user email': Couldn't connect to email.company.com
hi, when users submit new tickets, they receive the this error: There was an error sending mail from 'bugzilla maintainer email' to 'bugzilla user email': Couldn't connect to email.company.com Traceback: at Bugzilla/Mailer.pm line 190 Bugzilla::Mailer::MessageToMTA(...) called at Bugzilla/BugMail.pm line 370 Bugzilla::BugMail::sendMail(...) called at Bugzilla/BugMail.pm line 272 Bugzilla::BugMail::Send(...) called at /srv/www/htdocs/bugzilla/post_bug.cgi line 226 We are running bugzilla version 4.2.1 on Linux using smtp settings with authenticated user ...

Sending email via the port 465 of Gmail don't work! I don't know if there are bugs in .NET.
I use the following code to send  email via  Gmail , it works well when I use client.Port = 587, but it doesn't work if I use client.Port = 465 !  but If I use email client software such as Outlook Express with port 465, it woks well, I don't know if there are bugs in .NET.     protected void btnSend_Click(object sender, EventArgs e)    {        //Add Async="true" to .ASPX page         SmtpClient client=new SmtpClient();     ...

To send Email thru SMTP using PB.Net
Sir Please help me Sir I developed one program to send mail to General Manger when other manager requesting the holiday . I used MAPI mailsession . But that program is not working in some of the machine of Managers having outlook express with SMTP . But from some machine the mail automatically send to General manager without any problem. So I am trying to change the code to send the mail thru SMTP . I wrote a simple program in the similar way of the code in Sybase codexchange .Net Interop. I am using PB11.1.That program exe is working in my machine . When I try to run that ...

perldoc ESC problem (was: Send email using SMTP)
------=_Part_16029_20934709.1231597914868 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi there. Since the charset doesn't seem to be the problem, maybe this will help. Did some digging and found a bug report against redhat version 8 concerning terminal codes in perldoc output. There were comments about this being a bug in groff. https://bugzilla.redhat.com/show_bug.cgi?id=72125 They fixed it by making the default options for less be -isr You can do this on a linux box with: LESS="-isr";export LESS ...

Get email address from DB and send email using VB
OK every time I figure something out on my own, there's 10 more things I can't seem to figure out. I feel like a VB moron. Ha. Anyway. Here's what I need to do...1. Retrieve the email addresses from my database table of people whose memberships to my organization has expired in the past month.2. Somehow plug those email addresses into a code to send them a prewritten, preformatted email.I have found an article on how to send an email using VB coding. I just don't know how I would send one email to every person whose membership has expired in the past month. Ideally, I'd like to be able to log into my page and click a button that would send the email to every person. Is this even possible? Here's the article I found if seeing that code helps at all... http://www.4guysfromrolla.com/webtech/080801-1.shtmlThanks in advance for any help. Hi,append email ids in one string separated by semi colons and put the string in bcc property. and then send it....may be it worksbut beware if usend these many emails then the receivers email providers may list ur server's IP as spam source so then ur mails will be delivered to junk email folder. Yahoo is most active in these activities.Retrieve all data from database & fill dataset & then loop then email address in to field. however dont forget to sleep the thread for a while or else ur isp will treat u as spammer. also by putting each address indiv. in to will not be treated as spam. Kunal MehtaWeb professionals who ...

Send email using smtp
Hi all, I am trying to send an email using the following code: use Net::SMTP; $smtp =3D Net::SMTP->new("smtp.yahoo.com"); $smtp->mail('fulviocg'); but the error below is happening: Can't call method "mail" on an undefined value at .... Can someone help me? Thanks F=FAlvio From: "F�lvio" <fulviofs@gmail.com> Hi all, I am trying to send an email using the following code: use Net::SMTP; $smtp = Net::SMTP->new("smtp.yahoo.com"); $smtp->mail('fulviocg'); but the error below is ha...

Sending email using Comcast's SMTP server
Can anyone provide a code sample of using comcast's SMTP server to send email in asp.net 2.0? For some reason I can't get it to work. I am trying to utilize the web.config for most of the settings. Hey Hi, can you please tell if you are getting any errors or post some code, and one more thing what port are you using. ThanksKeyboard not found. Please Press < F1 > to RESUMEPlease Remember to Mark as Answer for the post(s) that help you.....so it can help others......Thanks  Add the following in web.config (just double the smtp server address) <configuration>...

sending email using SMTP
I have created an application in ASP.NET to send email using local SMTP, and there is no error in the code. But i discover that the mail is still inside the IIS, not posted to the receiver. Can anyone tell me what's wrong? Is it i have to have a real mail server in order to send the mail to the receiver? Thank you <script language="VB" runat="server"> Public Sub btnSendEmail_Click ( ByVal Sender As System.Object, ByVal e as System.EventArgs ) Dim objSmtpMail As SmtpMail Dim Mail As MailMessage = new MailMessage objSmtpMail.SmtpServer = "...

how to get the correct email format when sending email using sqldatareader
I'm getting the email address from an excel sheet.But i need to send the email to multiple peopleWhen printing the below i geta@a.com;b@b.com;; But i want a@a.com;b@b.com; i don't need the extra semicolon Thanks code below------ while (oledr.Read()) { smail = oledr[0].ToString() + ";" + "<br>";   //smail += oledr[0].ToString() & ";"; //mail.To.Add(smail); //this.Label1.Text = smail; Response.Write(smail); }   If oledr[0].ToString() contains only one email address (and not a few), then you can do it this way:while (oled...

How to send email using SMTP?
Hi... How to code send email and how to configure my SMTP. I have problem to send email and the error show the problem on my SMTP configuration. ive try many times with follow the instruction from article that i found on Internet however its still cannot solve the problem. Ive try to use component that i download from internet but i still dissatisfying because i cannot understand the flow. just use (its not good for a programmer. just my expectation). I hope somebody can give some idea how to configure SMTP easily and what the code should i use. i familiar using code vb. thanksPercaya pad...

Send email using SMTP
Hi all, I am trying to send an email using the following code: use Net::SMTP; $smtp =3D Net::SMTP->new("smtp.yahoo.com"); $smtp->mail('fulviocg'); but the error below is happening: Can't call method "mail" on an undefined value at .... Can someone help me? Thanks F=FAlvio The problem is that you are using an invalid smtp server address. You prob= ably want "smtp.mail.yahoo.com". For example, this works for me --=0A=0A#!= perl = =0Ause st...

Sending email using SMTP
I do not appear to be able to send mail using an external SMTP host. I'v tried most everything and it dows not appear to work inffact it hangs with this messahe in the httpd's logs: [Wed Jan 27 18:31:45 2016] [warn] [client 10.2.6.51] Timeout waiting for output from CGI script /var/www/html/bugzilla/process_bug.cgi, referer: http://10.2.3.3:90/show_bug.cgi?id=2 [Wed Jan 27 18:31:45 2016] [error] [client 10.2.6.51] (70007)The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed, referer: http://10.2.3.3:90/show_bug.cgi?id=2 I starte...

sendAsync email with 'sending email' screen and 'email sent' screen
hi i have written my first sendAsync contact form that sends me an email and it works fine. and when the sendCompletedCallback event is fired the contact form is set to display:none and screen is shown that says message sent. i am planning on adding an intermediate 'sending email' screen. is this a good idea is it necacery? can this only be done by calling a javascript function from the form's button's onclick event handler? or can it be done in the code behind by sending a response to the submitted form straight away before it is processed and then sending another when the e...

WindowsApplication can send email,but WebApplication can't send,and don't show error.
WindowsApplication can send email,but WebApplication can't send,and don't show error. this is code Dim strBody As String = "This is the body..." Dim OLApp As New outlook.Application() Dim msg As outlook.MailItem msg = OLApp.CreateItem(outlook.OlItemType.olMailItem) msg.To = "sbzhong@cclmotors.com" msg.Subject = "Automated e-mail" msg.Body = strBody CType(msg, outlook._MailItem).Send() ...

Email problem: Outlook won't send email from VWD
I found an example on how to send email using the System.net.mail namespace. I added it to my program and tested it. It should be working at the local host level. No errors appear, but no emal is sent either. Also, the confirmation code following the Client.Send(Email) line does not run. So I figure something must be wrong with my code, so I downloaded the sample code from the article, which can be downloaded from http://aspnet.4guysfromrolla.com/code/EmailDemos.zip  The sample code is a very simple stand-alone program to send email. I am running this sample from Visual Web Developer on a local machine runnig XP and Outlook 2002 SP3. This sample code requires you to replace smtp network settings in the  web.config file and add your email address at a couple places in the code-behind. When I run this sample code it also tells me (in a message window which follows the Send command) the email has successfully been sent . Yet I get no email sent. I'm guessing its something on my computer which is preventing it from being sent. I have tried temp turning off my firewall (I use Norton) and scoured the outlook settings for anything that might be stopping the emails from getting out. I'm stumped. Any suggestions on where to look? Thanks   Hi DennisMiller,  First, are you using Windows XP Home or Windows XP Professional? Windows XP Professional comes with a SMTP service. In order to send e-mail messages from an ...

cannot send email from webpage using System.Net.Mail on external smtp server
Every time I am trying to send email from my webpage, or using passwordrecovery tool , i get following error :: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed I went through all the existing posts, but none of them worked for me. I have already checked http://www,systemwebmail.com/ web.config settings are as follows <system.net>    <mailSettings>      <smtp from="noreply@allure.com"&g...

HMC 4.0
Is it possible for internal devices to use Exchange's SMTP to send emails outside of the company? How would that be configured? Thank you Alex  Of course you can use SMTP/POP.The settings are same with other normal smtp/pop email accounts. Here is a sample for how to configure outlook express:1. create a mail account in OE, use your CAS server's FQDN as the POP3/SMTP server name;2. Use your email address as the username, and type its pwd;3. On the Server Tab of your email account properties page, under Outgoing Mail server filed, check "My server requires authentic...

Creating Email Alias which would send email to select email accounts using HMC 4.0
Hello all,   I was wondering what is the best method of creating a email alias in exchange 2007. I tried using exchange 2007 console, but it seems the only way is to add the smtp address to each user. I did try a group, but it add's the default smtp address which I do not want there, and it complains when I try to remove it. I was wondering if there is a way from provision or exchange console....

Web resources about - A problem to send email using Smtp - I don't receive emails by sending emails using smtp - asp.net.getting-started

Resources last updated: 2/24/2016 3:04:35 PM