Mail an exchange server SMTP server response: 550-Verification failed - php

How do I send an email to my exchange server? When I set the php.ini file with send_from="x#domain.com" it says 550 verification failed. How do I verify myself?
I am using SMTP: mail.domain.com

Its probably a good idea to use a class like phpmailer http://sourceforge.net/projects/phpmailer/ to do this.
That way if you have multiple projects that need to send via a different account or different servers then you won't have any problems.
The error you're getting is because your exchange server requires authentication and your script isn't using authentication or its using the wrong information. I've never really relied on the built in php sendmail functions so I can't be 100% sure but I don't think it supports authentication. (I might be wrong on that point, but I still recommend a class that you can configure per script over a globally configured mail account)

Related

PHPMailer -- "Less secure" SMTP or PHP's mail() function?

I have a "lesser of two evils" quandary. The site I'm working on doesn't have SSL. So, I'm getting the SMTP issues described here: https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#php-56-certificate-verification-failure
So, the options seem to be...
Using the php mail() function via PHPMailer by NOT using the built-in $mail->isSMTP(); part of PHPMailer.
Going with the "less secure way" of sending SMTP mail as described in the link above.
Can someone who knows about this sort of thing weigh in with pros/cons of either route? Thanks.
Those two are not the only options. Figure out why the certificate is failing to verify using the tests shown in the guide.
PHPMailer will use encryption if either a) you ask it to, or b) if your server says it supports it, in which case it's enabled automatically.
If your server is presenting a self-signed or expired cert, it will fail to verify - you can either get a real cert, tell your mail server to stop advertising encryption if it's not configured, or tell PHPMailer not to use encryption at all by setting SMTPSecure = false and SMTPAutoTLS = false.
Not using isSMTP isn't any more secure - all that happens is the same connection happens from your local mail server, where it may (depending on your mail server's settings) face exactly the same issue.

What is the difference between isMail and isSMTP

I'm using PHPMailer and having a hard time getting isSMTP on bluehost to work. I have been able to get isMail to work and am wondering what the difference is in sending mail. Also, it seems that I'm getting a HELO or authentication error when trying to use isSMTP but bluehost says my setting are correct. I'm using SSL and port 465.
isMail and isSMTP are convenience methods to set the value of PHPMailer's Mailer property. This property determines how PHPMailer goes about sending a message after it has built it. With isMail, it's sent using PHP"s mail function. With isSMTP, it uses PHPMailer's accompanying SMTP class to act as an SMTP client, talking to a mail server directly.
Using the mail function requires that you have a mail server installed and running on your local machine - which, historically at least, has not been the case with Windows in particular. Generally using the mail function is fairly fast because it does not need to talk to a remote host, however, it's quite inefficient given that it actually acts as a front to the system's own sendmail binary, which simply opens a synchronous SMTP connection to localhost. You'll also get much less feedback - the mail function returns boolean value, so if it doesn't work it's hard to tell why it failed, and you will probably need to look in your mail server's logs to find out.
You can use the SMTP route to send to either local or remote mail servers, and typically SMTP to localhost is the fastest way to send. Because PHPMailer uses its own SMTP client to do this, it means it can see the whole SMTP conversation, and thus gets much better feedback when things don't work - you can set SMTPDebug = 2 and see the whole conversation.
There are various thngs that can go wrong, and the best place to track down the root cause is to read the PHPMailer troubleshooting guide.

Exchange rejecting php mail from same domain

I have an IIS server running PHP on an Apache Module. I am running a domain on it, and this domain has a seperate setup for email which uses an exchange server. When I try to send email from the website using php mail() the exchange server rejects it. I.e. the header from line is sender#this-domain.com and it is sending to receiver#this-domain.com, both are email addresses set up in the exchange, even though the sender has no direct relationship with exchange.
The emails are not getting through. We tried using a Yahoo adress in the from line but nothing. Has anyone ever come across a problem like this.
You have to either configure the exchange server to accept relay requests based on the origin ip or some transparent authorization mechanism (don't know much about IIS and Exchange and integrated windows authentication, but the good people over at http://serverfault.com do. ). Or use some mailing library that can handle smpt authentication like e.g. http://swiftmailer.org
I once ran into a problem like this which involved the Exchange server not wanting to accept anonymous connections or that it would only accept mail from certain SMTP servers. Have you checked the configuration on your Exchange server to eliminate those possibilities?

Sending mail via fsockopen?

I know this is possible, but can I do without a remote SMTP server or the like? Basically I want to send mail with PHP, but without mail()
I'm unsure what you exactly mean with 'without a remote SMTP server', as in any mail delivery at least one of those has to be involved - the one receiving mail on account of the recipient...
What you can probably do (it's up to you to decide if it's worth the effort) is to use PHP's socket functions to open a connection on port 25 with a remote mail server. Google 'SMTP telnet' for some examples of how a SMTP session looks like (quite simple, to be true) and then google for 'SMTP codes' for more explanations of what the remote server is saying you.
Possible, but not entirely trivial considering the fact that you should be familiar with SMTP, POP3 and/or IMAP to actually exchange data with a mail server.
You need to code your app so it mimics the behavior of an MTA, that is if you're going to do what the mail() function does - and using sockets. If you're on Linux, another option is to make an OS call to sendmail.
To not use mail() look into PHPMailer
I use this library for all my e-mailing code. I've extended it to have a debug mode so I can intercept outgoing e-mails while testing code.
I could be wrong but you will always be using an SMTP server even if that server is just the webserver with sendmail on it. If you were running your PHP on windows you'd need to enable IIS's in built SMTP service.

Mail relay and php mail

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

Categories