-
send email from website
hi
i can send an email from my localhost, no problems.
(set up relay to 127.0.0.1 for local host)
when i upload the app to the server machine.
the messages dont seem to come through when i try to send the emails from the website, on remote machine.
is there anything that should be done extra to ensure that this works or does it have to be coded differently.
thanks
-
Re: send email from website
ive just noticed that the messages are on the server machine
in the
c\inetpub\mailroot\queue
any idea why the messages are sitting there and not going out to the appropriate email addresses
-
Re: send email from website
Most likely because the website is blocking it? This is more of a server ocnfiguration issue, so if your server is hosted, you should contact them and ask them about the SMTP details.
-
Re: send email from website
yeh i had this before.
it is to do with the way relay is set up on your machine - you also have to have CDONTS installed on your server in order to send emails i believe.
-
Re: send email from website
the server in question is just a compter sitting beside me,
ill keep messing about with its configuration and let you know.
just making sure it wasnt my code as the code uses
SmtpMail.SmtpServer = "localhost"
thanks
-
Re: send email from website
i have the relays set up and the cdonts registsered on the machine
still everything sts in the queue folder
what a nightmare :sick: :cry:
-
Re: send email from website
just a possibility but could be the ISP denying you setting up relay on the computer - just a thought.
tried using another smtp service?
btw - what OS are you using? or rather what version of IIS?
http://www.microsoft.com/technet/pro...87a2b88f2.mspx
http://www.experts-exchange.com/Web/..._21599320.html
http://www.systemwebmail.com/faq/1.6.aspx
-
Re: send email from website
Code:
xp pro
IIS 5.1
SMTP Protocol
Microsoft Corporation
Version: Build 6015
im sitting here on this machine developing the app.
if i build and run it here it wokrs fine. i recieve the emails no probs
if i move my app to the machine beside me(xp pro), used as a server for the moment for development purposes all emails sit in that queue folder when i use my app from a remote machine.
both computers seem to have the same settings, though obviously not
im considering burning the machine, would this help?
VB Code:
Dim msg As New MailMessage
msg.Subject = "Query from customer"
msg.BodyFormat = System.Web.Mail.MailFormat.Text
msg.Body = lblcompanyname.Text & ", " & txtComments.Text
msg.Priority = MailPriority.High
SmtpMail.SmtpServer = "127.0.0.1"
Try
SmtpMail.Send(msg)
txtComments.Text = " * Message Sent Sucessfully *"
Catch exc As Exception
txtComments.Text = ("Send failure: " + exc.ToString())
End Try
-
Re: send email from website
hang on....
you are saying that all this works fine on computerA, which has the SMTP set up?
you are saying that this does NOT work on computerB?
if this is the case, change the SmtpMail.SmtpServer to the computername or IP Address of ComputerA (Which has the SMTP set up successfully)
-
Re: send email from website
Hello D2005,
I was reading your e-mail. I understand that you was having trouble sending e-mail from your web server computer. But you was able to send the e-mail out on your own comptuer. Well I am having trouble sending the e-mail out on my own computer. This is just a little problem l am writing myself on my computer. However, I have check the intepub/mailroot/queue and all the e-mail are just sitting there.
For the IIS I have configured the following. In general tab l have entered the ip address of my computer on port 25. On the access tab - connection i have granted access on 127.0.0.1 and - relay granted access on 127.0.0.1. The code l have is below. I have tried this with winforms and asp.net.
Please could you tell me what I might be doing wrong to send e-mail out on my own computer.
If you read my thrend on this forum, just below yours, you can read the history of what l have done.
Many thanks in advance,
Steve
Code:
using System.Web.Mail;
private void btnSend_Click(object sender, EventArgs e)
{
try
{
//Construct a new mail message and fill it with information from the form
MailMessage aMessage = new MailMessage();
aMessage.From = txtFrom.Text;
aMessage.To = txtTo.Text;
aMessage.Cc = txtCC.Text;
aMessage.Bcc = txtBCC.Text;
aMessage.Subject = txtSubject.Text;
aMessage.Body = txtMessage.Text;
//If an attachment file is indicated, create it and add it to the message
if (txtAttachment.Text.Length > 0)
{
aMessage.Attachments.Add(new MailAttachment(txtAttachment.Text, MailEncoding.Base64));
}
SmtpMail.SmtpServer = "127.0.0.1";
//Now send the message
SmtpMail.Send(aMessage);
//Indicate that the message has been sent
MessageBox.Show("Message sent to " + txtTo.Text, "E-mail Program", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
-
Re: send email from website
Quote:
Originally Posted by Techno
hang on....
you are saying that all this works fine on computerA, which has the SMTP set up?
you are saying that this does NOT work on computerB?
if this is the case, change the SmtpMail.SmtpServer to the computername or IP Address of ComputerA (Which has the SMTP set up successfully)
the ipaddresses of both machines shall be the same. they are both behind a router. i view my webpages through the use of port 88.
i.e. to view the webpage from server machine
ipaddress:88/webform1.aspx
it successfully worked when i just used local host or 127.0.0.1
not the computer name.
i seem to be a bit lost.
how do i change the smtpmail.smtpserver
-
Re: send email from website
no no, computers cannot have the same IP Address, the router issues a DHCP IP address to your computers - each computer will have a unique IP Address from DHCP
in your code where it says :
"SmtpMail.SmtpServer = 127.0.0.1"
change it to the name of computerA or the IP Address of ComputerA (the one which has the SMTP server working successfully)
-
Re: send email from website
Quote:
Originally Posted by steve_rm
Please could you tell me what I might be doing wrong to send e-mail out on my own computer.
Steve
steve
try my code given above.
to be honest with you i the only thing i changed was the relay to 127.0.0.1 in my smtp server. this allowed the emails to be sent succsessfully through
SmtpMail.SmtpServer = "127.0.0.1"
or
SmtpMail.SmtpServer = "localhost"
before you try it again
stop your smtp
delete all the files in the queue folder
then restart it because i think i heard somewhere that that may hold it up.
-
Re: send email from website
Quote:
Originally Posted by Techno
no no, computers cannot have the same IP Address, the router issues a DHCP IP address to your computers - each computer will have a unique IP Address from DHCP
in your code where it says :
"SmtpMail.SmtpServer = 127.0.0.1"
change it to the name of computerA or the IP Address of ComputerA (the one which has the SMTP server working successfully)
i think the router is issuing us numbers such as
10.0.0.20
and 10.0.0.9
etc.....
are these the ipconfigs you refer too
ill try it now in the mean time
-
Re: send email from website
the ipconfig that works through localhost is 10.0.0.20
it also works if i relay 10.0.0.20 and name it as my smtp server.
ill try it now on the other machine. (with different smtpserver)
-
Re: send email from website
the other machine is 10.0.0.9
and i changed the code and relays it accordngly
guess wot..........
it didnt work :cry: lol
i think ill just use pigeons to send mail. :ehh:
what is the queue folder anyways
-
Re: send email from website
the queue folders are where mail waiting to be sent are stored in.
so you set the smtp mail server in the code to 10.0.0.20 and that did not work? :(
-
Re: send email from website
10.0.0.20 works for the machine i develop on. no problems there
the ip of the server machine is 10.0.0.9 so i changed my code accordingly
it did not work on my server machine.
-
Re: send email from website
interesting, it should as the 10.0.0.20 machine works according to you.
im out lol
-
Re: send email from website
Quote:
Originally Posted by Techno
interesting, it should as the 10.0.0.20 machine works according to you.
im out lol
:D :D :D :bigyello: :p :bigyello: :D :D :D
Ill restart my machine. That always Helps
-
Re: send email from website
could the problem be?
im just throwing this out there.
because im using xppro, or has that got anything to do with it?
-
Re: send email from website
Hello D20005,
I have found some information on another post that told me that you cannot directly send e-mails from the outside to hotmail, yahoo, etc. In order for you to do this you have to send a username and password to be authenticated for hotmail, yahoo, etc. I thought it was possible to send e-mails to these accounts.
I did what you suggested and my code is similar to yours. I deleted the mails from inetpub/mailroot/queue and restarted IIS. But still did not work.
Did you manage to send an e-mail from your IIS to hotmail. I noticed that you assigned a hotmail address in your code.
Thanks,
Steve
-
Re: send email from website
yeah mines goes to hotmail no probs from my local host.
it just doesnt seem to run on the other machine.
we have to be doing something wrong
i dont think its the code, i think its the settings
lol
-
Re: send email from website
this maybe a long shot but what the hay,
does anyone know if you need outlook configured for the emails to send.
i think that maybe the only difference between the machines
:ehh: :ehh: :ehh: :ehh: :sick: :ehh: :ehh: :ehh: :ehh:
im actually going to leave this alone now because i am of the thinking that it will work when i put it to a real server. thanks all for your help and time.
steve, feel free to hijack this thread if yours still isnt working. :thumb:
-
Re: send email from website
Hi,
I had some similar problem couple of years ago and when i installed outlook on the server my problem was solved.
do u have office(outlook) installed on your machine? If yes then check if the server have it too...if the server does not have outlook try to installed id with some default account(virtual) or u can just use the outlook part of the office carnal(shell) or use the outlook dll...
-
Re: send email from website
remember you need to configure your server to have SMTP if you are sending emails from your own server, or insert the details of your SMTP provider when sending the emails in the smtpclient class
of course if you use Exchange...then it will do it all for you, the SMTP configuration and what not....
again, totally depends on how you are setting up SMTP on your server