I have question about sending emails from MVC3 application. I already read for exmple about ActionMailer.Net, I have seen a lot of forums and helpers from someone. Everywhere I saw SMTP server and its settings, for example in Web.config, or in appropriate method/function. Is it possible to send email without smtp settings? I am building application, which will be used by several users, I dont want to put them to need setting some SMTP...
I need to send emails like "Your password is xxxx, go to www.mysite.com, thank you." and so on. I dont need to have it in any mailbox (as history), I dont want reply for it.
Is there a possibility like in php where I use mail(...) function, without setting SMTP server, I can send from -> to what ever I want.
So am I bad understanding to something. Pleas help me to figue this out. Thank you very much
You have to have an SMTP server, otherwise you can't send mail via SMTP. The same is true with PHP.
Whether you need to have the settings depends greatly on your hosting. Most servers will have the SMTP stuff set up in a config file higher up the chain, so often you can leave the settings at their default, and ASP.Net will still be able to send mail using SMTP with no specific settings being necessary.
However, its also possible that your host will require you to use specific SMTP settings. That's something you'll need to check with the people who will be hosting your site.
If you need example code on how to send an email with minimal code, something like this should work, PROVIDED that your host doesn't want you to specify the settings:
var message = new MailMessage(FROM ADDRESS HERE, TO ADDRESS HERE)
{
Subject = "Please confirm your email",
Body = "PUT SOME BODY COPY HERE"
};
var client = new SmtpClient();
client.Send(message);
Is it possible to send email without smtp settings?
Of course that it is not possible. You cannot send an email without an SMTP server. This simply doesn't make sense.
It is possible to send mails without SMTP server directly through your code, i had already did this, but later after some months mail guard kind of things started to blocking my IP.
just read this blog.;)
Related
I am using php and Codeigniter, I need to implement the following schema
for list of emails I need to send emails for them, and if they reply to this email, I need to know if the reply and what the content of this reply and view it using my php project.
Also I need to send them a multiple choice question and they have to chose one option as answer, and then check this answer from my php project.
I can send email from my gmail, but can't send it from the wamp server itself.
Any help?
I'm not exactly familiar with CodeIgniter, but if you want to send an email, and it doesn't work, especially on Windows the common problem is that there is no SMTP server configured.
Most *nix distros have some form or another of a SMTP server running by default, Windows doesn't. When unconfigured PHP assumes localhost to be an SMTP server.
This SMTP server is what PHP needs to be able to send emails, so you'll either have to configure one or find one you can use that's provided by someone else.
For using PHP's native mail() function and any library that relies on it the configuration entries you're looking for are SMTP and smtp_port. (Have a look at: http://php.net/manual/en/function.mail.php)
It might very well be that your ISP provides a SMTP server. Otherwise you can always set up a gmail/hotmail/whatever account and use their SMTP settings. This is usually far easier than setting up your own server.
If you choose to set one up yourself, you'll want to look into SPF, so your messages don't get marked as spam by default.
As i'm knowing just about PHP and don't know at all about Mail Servers, what i want to know here is:
How can i get the "Replied" emails (from the receivers) for the mails i've send (by using PHP, with a address like xxxxxxx#gmail.com)
Does it need to setup my own Mail Server?
Unless using own Mail Server, is there any other easy way?
Honestly i'm not well understanding over IMAP or Email Protocols. Doing setup my own IMAP Server is far worse. Can it be done simply with a Web Hosting which supporting IMAP protocol? Or do i need to setup manually out from the start?
To be brief, i need a simple guide.
You only need a mail server if you don't already have a place where those reply-tos end up. Which adress are you sending them as? Where would you fetch the emails for those adress? You can ask PHP to log into any mail server that you'd fetch your emails from manually as well, so there shouldn't be a problem. But maybe I'm not getting you right.
Simply put the reply address to an email you own. For the example you gave to work, you would need to have the xxxx#gmail.com account.
Most people use something along the lines of mailer#youdomain.com, ans then create an account for that on their ma8lserver.
If you want to use your own domain, you don't need to run your own mailserver. Gmail, hotmail, and others have services that let you use their mailservers for your fomain, for free.
I have spent the last 15 hours trying to figure out a simple, free way to send a simple text email via a php script when a form is filled out on a html page. I don't care how it looks, as these emails are only going to be sent to me (at most 15 a day). I don't need anything except a simple email to me when the form is filled out. I understand everything except I cannot get past:
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
What i have tried:
Playing around with the pear mail extension and using smtp.gmail.com
Downloading countless smtp mail server applications.
Using my ISP smtp and port 25: smtp-server.wi.rr.com.
Using PHPMailer.
Using the windows SMTP server.
Although all of these things should work... I am apparently too dumb to figure it out. I have read every sentence on the subject on the internet and have tried to follow instructions, but each time I try something else, I just run into more problems. Someone PLEASE give me a simple fix to this, so I can never look at PHP mail stuff again.
If you're sure all these settings are correct, you should check your firewall. If all else fails, try sending a mail from a mail client (or make an attempt using Telnet!). If this succeeds, than you're doing something wrong in the PHP configuration, or the way you send the e-mail. If sending fails with other clients too, than the problem lies in the ability to send e-mails from that computer at all.
Your own ISP should work fine. Remember that most ISP's don't require you to enter a password. Only the smtp server will suffice in that case.
Folks.
After many hours of trying I found that:
You don't need additional tools like mailservers or pear additions. These only provide additional potential security leaks that you have no control or insight over.
To get mail function to work on localhost, all you need to do is change the php.ini file.
I just checked my outlook account settings and copied those to the php.ini file.
So SMTP server, port, username and password.
Now,
You may think it does not work but
You should know that many mail clients reject emails if the From field has a different domain than the actual domain an email is received from.
So if the php.ini file contains for example
smtp.ziggo.nl
Be sure that the header contains:
From: info#ziggo.nl
So for making universal code on both localhost and remote host, I check for the existence of a file that I only have locally (e.g. z_local) and set the headers accordingly. If the local file does not exist I must be on the remote ISP and choose the header "From: info#remotesite.com"
I have a VPS server at UltimateHosting.com and requires that I use "Smart Relay". I cant seem to wrap my head around how I setup php to be able to use mail relay.
Here is an article they have on Smart Relay:
http://support.ultrahosting.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=142
The server is using cpanel and exim
I sent the following support ticket:
How do I configure the server to send
mail using php. I am writting a script
that will send the users passwsord
usigng PHPs mail function. However the
emails sent are never delivered. Does
this have to do with "smart relay"?
Any guide on how to configure this?
Response was:
While we do not provide scripting
support of any kind, if you simply
ensure the smart host is hard coded in
your script (no authentication is
necessary) the email should be
forwarded accordingly.
If your script uses the server's SMTP
server to send out email, you'll have
to ensure the MTA is configured to use
the smart host
.
Could anyone please clarify what I need to do in order to fix this?
I got the answer on ServerFault see https://serverfault.com/questions/188840/configrue-exim-sendmail-for-relay for details.
In short, I needed to change the default generic hostname and apply the route relay
I'm coding in PHP w/ CodeIgniter and I'd like to test some of the features in my app that send emails.
For some reason, I couldn't send emails through my email account in my local server (XAMPP), and I also don't want some SPAM filter to think I'm spamming while I'm testing.
So is there any email service that I can use for testing purposes? preferably one that doesn't enforce SSL, since I have problems getting that to work on my local server.
Appreciate your help.
As long as you're not sending out dozens or hundreds of test E-Mails, use whatever your everyday E-Mail provider is (e.g. GMail). Set the SMTP server of your mailing function to point to Google's. (I think SSL is optional with GMail, but I may be wrong.)
If your mailing library doesn't support using an external SMTP server, switch to a different one. But I think CodeIgniter has you covered there.
If you just want to test the application functionality, check out Papercut. This utility simulates the sending of email without having to set up a mail server, works great!
edit: had wrong link.
I like to set up a test SMTP service on my development machine and just send to that. There are several good options listed under this question.