Please help me send email using php, I searched trough google and found out that I need to reconfigure/edit my php.ini and change SMTP value and smtp_port,
I dont know what exactly what will I put on those lines.
Thanks for helping!
It would be a lot easier to use a phpmailer script like this, but you can also do it without that by setting: smtp_ssl = ssl and configure the sendmail.ini so that it connects with your #gmail.com account credentials, or it will not be able to connect.
Related
I'm attempting to send some test mail to myself while working on a PHP script. I've researched some other questions and it led me to this tool:
http://www.toolheap.com/test-mail-server-tool/
Others have said that it works perfectly but I'm having trouble using it myself. My php.ini files should be reset to default values as I tried to change the SMTP values at one point, but now they are back to "smtp.wlink.com.np".
For anyone that has used this tool, how does it work? Where do I have to send the e-mail to?
$to = "localhost";
?
Set the php.ini SMTP settings to 127.0.0.1 and port 25.
Send the email to anyone, any address (i.e., send it to obama#whitehouse.gov).
The tool will "intercept" the email, and show it to you. The email will never leave your system.
I was trying to find what i should change on php.ini settings to allow PHPMailer to work, Is there any guide that explain what i should change on php.ini?, Thank you all and have a nice day.
have a look at the googler results
Tut at :
http://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html
http://www.smtp2go.com/docs/php_mailer/
http://www.quackit.com/php/tutorial/php_mail_configuration.cfm [more here!]
Shoot at : http://board.phpbuilder.com/showthread.php?10378410-PHP-mailer
http://www.daniweb.com/web-development/php/threads/355029/php-mailer-problem
Talk at :
http://board.phpbuilder.com/showthread.php?10378410-PHP-mailer
Sending an email using PHPMailer and GMAIL SMTP
Thanks!
or you can relay GMAIL if you don't have any email server. http://www.icpep.org/use-gmail-account-to-relay-email-from-php-mail-function/
After sending an e-mail using PHPMailer to my Gmail account, after clicking 'show details,' to the right of 'mailed-by,' it says 'yourhostingaccount.com.' Here is a picture:
I've read you may change it using the fifth parameter of PHP mail(), although I'm not using that. Is there a way to change this using PHPMailer? Thanks!
Have you tried:
$mail->Host = "domain.com";
I found out that my domain and hosting provider, FatCow, uses NS1.YOURHOSTINGACCOUNT.COM and NS2.YOURHOSTINGACCOUNT.COM as their domain servers. This explains why it is happening, as I was connecting via SMTP to an e-mail address hosted by them. Unfortunately, I don't think I can change that and solve my problem... oh well.
Is there a way that I can configure the WAMP server for PHP to enable the mail() function?
Configuring a working email client from localhost is quite a chore, I have spent hours of frustration attempting it. I'm sure someone more experienced may be able to help, or they may perhaps agree with me.
If you just want to test, here is a great tool for testing mail locally, that requires almost no configuration:
http://www.toolheap.com/test-mail-server-tool/
Install Fake Sendmail (download sendmail.zip).
Then configure C:\wamp\sendmail\sendmail.ini:
smtp_server=smtp.gmail.com
smtp_port=465
auth_username=user#gmail.com
auth_password=your_password
The above will work against a Gmail account.
And then configure php.ini:
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
Now, restart Apache, and that is basically all you need to do.
Using an open source program call Send Mail, you can send via wamp rather easily actually. I'm still setting it up, but here's a great tutorial by jo jordan. Takes less than 2 mins to setup.
Just tried it and it worked like a charm! Once I uncommented the error log and found out that it was stalling on the pop3 authentication, I just removed that and it sent nicely. Best of luck!
You need a SMTP server to send your mail. If you have one available which does not require SMTP authentification (maybe your ISP's?) just edit the 'SMTP' ([mail function]) setting in your php.ini file.
If this is no option because your SMTP server requires authentification you won't be able to use the internal mail() function and have to use some 3rd party class which supports smtp auth. e.g. http://pear.php.net/package/Mail/
I tried Test Mail Server Tool and while it worked great, you still need to open the email on some client.
I found Papercut:
https://github.com/ChangemakerStudios/Papercut-SMTP
(updated URL for 2021)
For configuration it's easy as Test Mail Server Tool (pratically zero-conf), and it also serves as an email client, with views for the Message (great for HTML emails), Headers, Body (to inspect the HTML) and Raw (full unparsed email).
It also has a Sections view, to split up the different media types found in the email.
It has a super clean and friendly UI, a good log viewer and gives you notifications when you receive an email.
I find it perfect, so I just wanted to give my 2c and maybe help someone.
Sendmail wasn't working for me so I used msmtp 1.6.2 w32 and most just followed the instructions at DeveloperSide. Here is a quick rundown of the setup for posterity:
Enabled IMAP access under your Gmail account (the one msmtp is sending emails from)
Enable access for less secure apps. Log into your google account and go here
Edit php.ini, find and change each setting below to reflect the following:
; These are commented out by prefixing a semicolon
;SMTP = localhost
;smtp_port = 25
; Set these paths to where you put your msmtp files.
; I used backslashes in php.ini and it works fine.
; The example in the devside guide uses forwardslashes.
sendmail_path = "C:\wamp64\msmtp\msmtp.exe -d -C C:\wamp64\msmtp\msmtprc.ini -t --read-envelope-from"
mail.log = "C:\wamp64\msmtp\maillog.txt"
Create and edit the file msmtprc.ini in the same directory as your msmtp.exe file as follows, replacing it with your own email and password:
# Default values for all accounts
defaults
tls_certcheck off
# I used forward slashes here and it works.
logfile C:/wamp64/msmtp/msmtplog.txt
account Gmail
host smtp.gmail.com
port 587
auth on
tls on
from ReplaceWithYourEmail#gmail.com
user ReplaceWithYourEmail#gmail.com
password ReplaceWithYourPassword
account default : gmail
I used Mercury/32 and Pegasus Mail to get the mail() functional. It works great too as a mail server if you want an email address ending with your domain name.
I do not know too many details except that I access the internet from behind a proxy server (I have the IP and port)
and that I'm running PHP out of localhost (using WAMP)
The mail() isn't able to send emails.
Really new to PHP, so would appreciate help fixing this.
Do you have access to the php.ini file or the ability to override php.ini settings with the ini_set function?
Then you can try and override the SMTP settings and replace it with for example your ISP settings:
http://www.php.net/manual/en/mail.configuration.php#ini.smtp
Apparently you can't set a username/password if required by the SMTP server. So you probably have to use a third-party e-mail library. Try Swift: http://swiftmailer.org/
Or check this post with a similar question: php.ini & SMTP= - how do you pass username & password