Send email SMTP from localhost with WAMP setup - zend-framework

I'm trying to configure my php.ini file so I can send emails from 'localhost' in my dev environment using PHP. I no longer have access to an open SMTP server, and Gmail no longer works with their new SSL setup. I've done a lot of research and seen lots of "solutions" here and elsewhere, but they don't work. I've tried installing local SMTP servers (hMailServer asks for a password to install, Free SMTP Server doesn't work, etc).
Does anyone know of a free SMTP server I can setup in my php.ini file, or any other way to send mail from localhost (I just need it for testing purposes). I don't want to have to change code and send emails in a completely different way when I switch to production. (I'm using Zend and the Zend_Mail class)

You could try using Zend_Mail_Transport_File for testing instead.
$mail = new Zend_Mail();
$mail->send(new Zend_Mail_Transport_File());

In windows I was usually using Mercury to sent emails from localhost for testing purposes. Mercury is free for non-commercial use and it is also used in xampp.

Solution for XAMP, WAMP or etc..
download hMailServer; Then configure program:
When you first open hMailServer Administrator, you should add new domain.
Click on the "Add Domain ..." button at the Welcome page.
Under the domain text field, enter your computer's IP, in this case it should be 127.0.0.1.
Click on the Save button.
Go to Settings>Protocols>SMTP and select "Delivery of Email" tab
Enter "localhost" in the localhost name field.
Click on the Save button.
If you need to send mail using a FROM addressee of another computer, you need to allow deliveries from External to External accounts. To do that, follow these steps:
Go to Settings>Advanced>IP Ranges and double click on "My Computer" which should have IP address of 127.0.0.1
Check the Allow Deliveries from External to External accounts checkbox.
Save settings using Save button.
If you use Gmail account, then need small modification :
Go to Settings>Protocols>SMTP and select "Delivery of Email" tab
Enter "smtp.gmail.com" in the Remote Host name field.
Enter "465" as the port number
Check "Server requires authentication"
Enter your Google Mail address in the Username field
Enter your Google Mail password in the password field.
Check "Use SSL"

You will have to use this confuguration for the transport of the mail
$transport = new Mail\Transport\Smtp();
$options = new Mail\Transport\SmtpOptions (array(
'name' => 'host',
'host' => 'smtp.gmail.com',
'port'=> 587,
'connection_class' => 'login',
'connection_config' => array(
'username' => "yourGmailUserMail",
'password' => 'yourGmailPassword',
'ssl'=> 'tls',
),
));
$transport->setOptions($options)
;
and it will works.

Related

I can't connect my email to my email client (VPS - CyberPanel)

i have a server on RackNerd, after I successfully installed Cyberpanel, and my website was online, I created an email on Cyberpanel. Then I connected via my email client (MailBird) but it was always rejected, I have entered the data correctly, such as "Server Hostname", "username" and "password" for my email.. What should I do?
By simply saying it was always rejected doesn't provide enough information to debug your issue. Though you could try these:
Mail server SSL is issued
Postfix & Dovecot is running properly
All mail related ports are open in the firewall

No Such User Here VPN/WHM with Mail Routed through Separate Server

Ok, I am using a VPN on GoDaddy for webhosting. But on one of the websites that I am hosting, the email is handled on a separate VPN.
So I have an A record for domain.com set to the GoDaddy VPN and an A record for mail.domain.com set to the IP of the other domain and several CNAMES pointed to that A record. It's all working beautifully except for one thing....
Email from other domains on the GoDaddy VPN cannot send to this domain. So myemail#mydomain.com cannot send to email#separateemailvpn.com
I get error "No Such User Here" from my server.
I understand that the GoDaddy VPN is checking for that user locally and not finding it, but I don't know how to make it NOT check for this domain.
I am using WHM/cPanel with Exim and SpamAsassin. Thanks!
Not sure what the deal is with the downvotes, but here was my solution (probably obvious).
From Linux Terminal:
sudo su (for admin rights)
nano /etc/localdomains (erase domain from local domains)
nano /etc/remotedomains (add domain to remote domains)
Now it doesn't check that domain for users locally before it sends it out to the remote server.
Changing the mail exchanger on the server is relatively easy from WHM too. In WHM left menu, navigate to "DNS Functions >> Edit MX Entry". From there, simply select the domain name you wish to edit, and then select the desired mail exchanger to change the mail routing settings for the domain.
The options are Auto, Local Mail Exchanger, Backup Mail Exchanger, or Remote Mail Exchanger. Set to "Remote Mail Exchanger" and click Save to have WHM update the /etc/localdomains and /etc/remotedomains for you.

Mail plugin issue in grails - mail not reaching destination

i am new to grails ,
i created a new project to check mail plugin.
In the controller i added the following command in index
sendMail {
to "my_mailid#gmail.com"
from "another_valid_id #gmail.com"
subject "link test"
body 'haiiii'
//html g.render(template:"mailtemplate",model:[code:UUID.randomUUID().toString()])
}
render "send"
when i am running the application it shows no error and display send in browser. but when i am checking the my mail inbox mail is not reached.
i didn't done any changes in config file. as it by default works in localhost and in port 25.
thankz in advance
http://grails.org/plugin/mail
By default the plugin assumes an unsecured mail server configured at localhost on port 25. However you can change this via the grails-app/Config.groovy file.
It assumes an unsecured mail server on your localhost on port 25. If there isn't one running there, it won't send mail. I'm not sure what your operating system is, but if you are on a mac or *nix system, postfix comes installed.
sudo postfix start
If you're on Windows you can find an alternative. Honestly, it's easy to simply configure to send from a gmail account which is what I have done for my clients. You can see how to do that at the link above.

Plesk, Email with localy established domain where the mail server is external

i have a big problem with the setup for an Domain.
The Webservices are established on our Server but the Mail functions are on a Server of an other Company when we now want send an Email over our Server he tried to send it localy insted of sending it to an other server so he give back an no account here error.
Thanks for helping me out and friendly greetings.
Edit: OS Debian 6
Imap: Courier
Send: Postfix
CP: Plesk
Further to this, we are using Plesk 11.5.3 on a setup where a single mail service is activated for all domains.
So each domain cannot have the mail service turned on or off individually.
We had the same problem as Franco, and we fixed this by running the following command for each domain that had external email:
# /usr/local/psa/bin/mail --off domain.com
Works perfectly, and removes any previously created local email addresses from Postfix.
"The problem is because the server will attempt to deliver emails for the domain name locally by default. To resolve that problem you would need to set it to use the domain name's MX record."
The simple answer is to disable mail services for the subscription.
Untick the box for "Activate mail service on domain".

how to send email in joomla if my webpage is run on localhost?

i used login module in my webpage. in that by clicking on 'forgot password?' i need to give an email-address but by clicking on Send button the error is 'could not install mail function'.
so, please give suggestion, my web page is running on localhost.
It appears your computer's version of php does not have working mail. I would suggest you A: reinstall joomla, B: find the hash function in the php and replace the old password hash with a new one, or C: find a mail plugin for your version of xamp/wamp/whatever.
If you are in a Windows platform try the following:
Open the php.ini file. For XAMPP, it is located in
C:\XAMPP\php\php.ini
Change the localhost to the smtp server name of
your ISP. Leave smtp_port as 25.
Change sendmail_from from me#localhost.com to your domain email address which will be used as the from address
Restart XAMPP or WAMP (apache server)
Try to send the mail using the mail() function
I think it should solve your problem.