I am trying to send an email from my mac using the php mail() function, but I cannot seem to get it to work. I can start sendmail from the terminal with no errors, and have edited my system's php.ini file found at /private/etc to set sendmail_path to /usr/sbin/sendmail -t -i and uncommented it. I created a simple php script:
<?php
mail("<my email address>", "Test", "This is a Test Message", "From:" . "<another of my email addresses>");
echo "Mail Sent\n";
?>
and I am running it from the terminal using php mail.php. It echoes "Mail Sent", however it seems that no email is being sent. It is getting lost somewhere, but I have no clue where. I have restarted Apache, double checked that sendmail is running, yet nothing works. Any ideas?
you can not send mail using "mail()" function from your localhost, for that you have to host your code on any hosting provider then you can send the mail from it
see this link for more information.
if you want to send mail from localhost then you go for specific API like, if you want to send mail using your gmail credential then try this php mailer
Related
I have a WHM server - with several PHP scripts on it that send off emails. It used to work until apparently just recently. Now, it seems to have stopped sending emails from those scripts.
Given that I know there's no problem with the scripts themselves, how would I go about debugging why they're no longer being sent?
Here's what I know so far:
PHP Scripts should be fine, nothing has changed on them
Server does not appear on any spam blacklists
Test email script does not generate any errors, nor is there anything hung up in the WHM queue
Nothing shows up in the gmail accounts (regular or spam boxes) for what's supposed to have been sent.
Any ideas?
WHM 60 Build 35, CentOS 6
Please try to follow the instructions bellow which could help you in debbuging your email issue(s):
1) - check if you server has a valid hostname like host.domain.tld and that hostname actually points to the server's ip address
2) - check if you have rDNS setup correctly for your server's ip address and the reverse DNS should match the hostname
3) - Use Mail Queue Manager from WHM (in the left search in WHM got o Email -> Mail Queue Manager) and see if there are any emails in the mail queue there
4) - Use Mail Troubleshooter from WHM ( Email -> Mail Troubleshooter) and see what happens when you try to send an email to a gmail address
5) - You could check the Exim server logs by logging in via ssh and do a tail -f /var/log/exim_mainlog
Most probably your emails are in the server's mail queue and for some reason they are not delivered
i am trying to connect to a remote machine(Windows) using TST10 script.i have the VPN access to that machine. i want to automate the telnet session using the TST10 script, kinldy help.
my code is:
xx.x.xxx.xx
WAIT "login:"
SEND "domain\username\m"
WAIT "password:"
SEND "VPNpassword\m"
WAIT ">"
SEND "command 1\m"
WAIT ">"
SEND "command 2\m"
Here the "username" is the VPN username and not the user account name on the remote machine and "domain" is different from my computer's domain.
If i am telnetting manually from my command prompt with the same VPN credentials, it is working.
But, using the script, i am getting an error : the handle is invalid.
Do i need to give the credentials of the user account in the script or these VPN credentials can also work.
Also, please tell me the reason why i am able to do it manually and why not using the script.
you need a double backslash between your domain and username:
xx.x.xxx.xx
WAIT "login:"
SEND "domain\\username\m"
I am trying config Exim to accept email sent from an other server, but I can not.
On my server, I can sent email to local user:
# echo "This is test 1." | mail -s Testing_1 user_a#mydomain.com
so i want send an email to user_a (with add: user_a#mydomain.com) from other domain (eg: gmail, yahoo)
I try sent an email from gmail account to user_a#mydomain.com, so check exim log (/var/log/exim_mainlog) nothing here?
maybe this email can't sent to my server with #mydomain.com . Or Exim can't receive any email?
os: CentOs, dedicated!
Many times when you have a problem with exim, you can simply Google the word "exim" and the error message to find others who have had the same problem. Most of the time, whatever you find will be someone asking nearly the question as you in a webhosting forum and the fix for it later in the same thread. I searched for exim Failed to find user "system" from expanded string and found the full thread and the exact answer further down in that discussion.
Based on the results of that discussion thread, you appear to be using CPanel and its custom Exim configuration. Per the instruction in that thread, fix the entries in your /etc/userdomains and that problem will go away.
i am getting some line of message in /var/spool/mail/ec2-user log file, when alert mail is not delivering to the user by using cronjob .
all emails sent from my amazon ec2 server via php programs such as windows live mail would have following header message
X-Authentication-Warning: ec2-user set sender to email using -f
i m getting this problem from recently only, at the beginning i didnot face this problem
i m using following windows live mail configuration
ini_set('SMTP', "smtp.live.com");
ini_set('smtp_port', "25");
ini_set('sendmail_from', "admin#mail.com");
ini_set('password',"password");
ini_set('Security','Enable TLS');
I am trying to send mail using vb.net from iis through a smart host (mailenable) and out through the internet. When I send mail without attachments it goes out just fine. When I send mail created the same way with an attachment the smart host gets an error sending the email.
"mailenable the remote server appears to have failed or to have rejected the contents of the message"
The smart host is correctly set up with reverse dns and MX records set up correctly. What am I missing?
Happens with .txt and .jpg files both - Attached using system.net.mail.attachment(inputstream, attachmentname, mimetype)
The remote server is rejecting it
the smarthost is making an attempt
Sending attachments to the remote server using outlook works fine
I would concentrate on this portion of the error:
"...rejected the contents of the message"
.. since you have confirmed that sending mail works fine without the attachment.
What time of attachment is it?
How are you attaching it?
Have you checked with the server admin (might be yourself) to see what types of files may be sent through that system?
Be aware that a lot of mail servers rejects email with attachments with files .exe, .bat, .cmd, etc (executables) and zip files containing any of this files.
Can you send the same message with a standard SMTP mail client? Alternatively, can you send the same message using your code via a different mail server (i.e., Google's Gmail IMAP server)?