Mails are sending from my php application using mail function. But client says it is from Mandril mail service. I logged into the Mandril account and found the mails sent. I checked the code. But didn't see any piece of code using the Mandril mail. It only uses php mail function. How can verify this?
My send mail path is configured like:
sendmail_path is /usr/sbin/sendmail -t -i -fadmin#abc.com -Fno-reply.
Note: I don't have access to the server.
The Mandril mail account was configured in sendmail confuguration. So when ever we use the php mail() function it will send through this account. Since the configuration lies in the send mail config file no any piece of code was there in the php code.
Related
I using php and CodeIgniter to send email but after change the server have following strange problem.
Each mail are sent to recipient and to sender.
After long debug of this problem I came to the following case.
mail("example#exmaple.com",$title,$body,$headers);
Work as expect send email only to "example#exmaple.com".
But
mail("example#exmaple.com",$title,$body,$headers, "-f example#domain.com ");
Send email and on both mail "example#exmaple.com" and "example#domain.com"
The problem is I do not know why she sends both emails.
I want to send only to "example#exmaple.com"
Here's what it says about this parameter php.net
The additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.
Obviously this parameter needs me but it is only for authentication and should not be sent to the e-mail "example#domain.com",
I've a dedicated server for sending emails with different domain and I'm running nginx and php on the ubuntu server. I've configured ssmtp to send emails which is working fine from terminal using echo from terminal. I want to use php mail function to send mails from the server and I'm using ssmtp. How can I do that? I've made changes in php.ini file in php fpm directory as follows:
smtp_port = 25
sendmail_from = noreply#instaclasses.info
sendmail_path = /usr/sbin/ssmtp
mail.add_x_header = On
I need to configure the php mail function so that any mail sent from mail function is sent from default smtp server configured already.
You can use PHPMailer - this very usefull library. In this all working from all external servers (inc. GMail).
I keep getting this error when I try to send an e-mail in PHP:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\dressoholic\register.php on line 50
my php.ini looks like this:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = you#yoursite.com
I'm using my laptop as a server.. What am I doing wrong? Thanks.
You need to be running a mail server locally.
If this is Unix, enable sendmail
If this is Windows install the Simple Mail Transfer Server (not sure if the name is correct) component of IIs. E.g. for windows 2003 follow this: http://msdn.microsoft.com/en-us/library/8b83ac7t.aspx
For sending mails using php mail function is used.
But mail function requires SMTP server for sending emails.
we need to mention SMTP host and SMTP port in php.ini file.
Upon successful configuration of SMTP server mails will be sent successfully sent through php scripts.
On windows, nearly all AMPP (Apache,MySQL,PHP,PHPmyAdmin) packages don't include a mail server (but nearly all naked linuxes do have!). So, when using PHP under windows, you need to setup a mail server!
Imo the best and most simple tool ist this: http://smtp4dev.codeplex.com/
SMTP4Dev is a simple one-file mail server tool that does collect the mails it send (so it does not really sends mail, it just keeps them for development). Perfect tool.
If you are running your application just on localhost and it is not yet live, I believe it is very difficult to send mail using this.
Once you put your application online, I believe that this problem should be automatically solved. But i think ini_set() helps you to change the values in php.ini during run time.
First of all, you aren't forced to use an SMTP on your localhost, if you change that localhost entry into the DNS name of the MTA from your ISP provider (who will let you relay mail) it will work right away, so no messing about with your own email service. Just try to use your providers SMTP servers, it will work right away.
PHP mail function can send email in 2 scenarios:
a. Try to send email via unix sendmail program
At linux it will exec program "sendmail", put all params to sendmail and that all.
OR
b. Connect to mail server (using smtp protocol and host/port/username/pass from php.ini) and try to send email.
If php unable to connect to email server it will give warning (and you see such workning in your logs)
To solve it, install smtp server on your local machine or use any available server. How to setup / configure smtp you can find on php.net
Change SMTP=localhost to SMTP=smtp.gmail.com
I have an Amazon EC2 instance running with RH/Linux. My problem is php mail() function which is not working although I can send mail with sendmail from command line.
I run this command. # telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
XXXXX
My php.ini setting is
mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On
I can't fingure out whats wrong. I am not getting any php mail error. I don't get any email as well. What could the problem be?
Sending mail on EC2 is notoriously difficult. Most of the EC2 IP addresses are in spamming blacklists. This, combined with PHP mail()'s terrible error reporting results in a pretty horrible experience.
You'll want to use Amazon Simple Email Service in combination with EC2. They recently added an SMTP service, meaning you can use any standards-compliant PHP mailing library to send mails.
I personally recommend Swiftmailer for this task.
I have currently the following and it's not working. (normally I have a body text and header information, but nothing works)
mail("idealvisions#live.com","Nieuw offerte aanvraag","test");
We'll on my server it did because I'm running php 5 or higher, no problem there. But the contact page is from a client which runs php 4.4 I believe. Now the client is really pushing me to get this fixed but it won't seem to fix. I've tried everything
What's the problem here? is it the php version?
I checked also with phpinfo and have this
sendmail_from no value no value
sendmail_path /usr/local/bin/bgc_webhosting_mailer.sh /usr/local/bin/bgc_webhosting_mailer.sh
This sounds like the Client's server is not set up properly with a mail-sending handler
some ISP's that provide hosting and some free hosting platforms disable the mail function, can you try something like this:
error_reporting(E_ALL);
if (mail ('you#yourdomain.com', 'Test subject', 'Test Body')){
echo 'Mail sent';
}else{
echo 'Mail not sent';
}
if there is an issue with mail() on their server you could consider posting to a mail form on one of your servers and then bouncing them back to a thankyou page on the client's server after.
From the sendmail path, your host uses a custom sendmail program/shell script.
Since the sendmail from isn't set, you have to set it within the mail() function, unless it is hardcoded into /usr/local/bin/bgc_webhosting_mailer.sh in which case you should ask the hosting.
Example setting sender:
mail('recepient#example.com', 'Test subject', 'Test Body', "from:sender#example.com\n");
If the mail() function really is NOT available, then ask your hosting about an alternative, such as their local SMTP server.
You can then use the local SMTP server to send email. Probably the easiest way to do this is donwload an email library that supports sending via SMTP such as PEAR Mail or SwiftMailer for example.
Pear: http://pear.php.net/package/Mail
Swift: http://swiftmailer.org/
If your host does not provide an SMTP server, you should probably look for a different host. However, you can always use a free email service such as Gmail, or Yahoo and send mail through their SMTP.
Also check SeLinux, it can prevent any thread spawned by Apache to send mail. In that case you get no error and no mail.