this might be a noobish question. Let me determine if I'm able to send emails in the server that say, domain1.com is connected with, as originating from domain2.com as well as getting the foundation show as originating from domain2.com?

The main reason Let me do that, happens because I've a credit card applicatoin I am developing and want to send emails in the domain, for instance - maildomain.com rather than originating from domain.com

Emails are now being sent with php's mail function.

Yes, you are able to:

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example-two.com' . "\r\n" .
    'Reply-To: webmaster@example-two.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

You need to setup several things, therefore the receiver does not measure the level as junk e-mail though:

  • Setup DNS MX records with low priority for that receiving domain, pointing to delivering server
  • Setup correct reverse DNS records for delivering server
  • ..

The "From" address within an email is entirely arbitrary. As lengthy as you've permission to submit mail to some server's queue, place the any From address inside it that you would like. leader@whitehouse.gov, julian@wikileaks.org, etc.

To get this done with PHP's mail() function, use *$additional_headers*. For instance:

$to      = "whoever@example.com";
$subject = "This is an example!";
$message = "Hello,\n\nThis is message body.\n\nIsn't that nice?\n\n";
$headers = "From: El Presidente <president@whitehouse.gov>\r\n"
         . "X-foo: bar\r\n";

$result = mail($to, $subject, $message, $headers);

Possible? Yes is certain is. Begin to see the below example from PHP.internet. However, I am likely to put just a little bit of small print here, when i think you may encounter some trouble, and I wish to allow it to be simpler for you personally later on. ) Your present webhost may block this, I have never witnessed it, but I have heard it may happen. Also, there's a factor known as SPF, or Sender Policy Framework, that's a DNS record that you could set to determine which servers can send in your account. Many servers that may receive your mail, and particularly GMail look for valid SPF. All you want do is give a TXT record in your title server for domain.com. It will look something similar to this: v=spf1 mx a:maildomain.com -all. This states any records with an MX record setup, and also the Insolvency practitioners which are resolved from maildomain.com are valid 'non-spam'. Also, you'll to fail every other mail origin.

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
  'Reply-To: webmaster@example.com' . "\r\n" .
  'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

When the mail server is definitely an open mail relay then yes, you are able to send from the different domain. It's obviously seen as an vulnerability as spammers may use it to transmit out spam. The configuration from the mail server to obtain this functionality is dependent on its platform however, you usually can test a server's capability to freely relay messages by telneting to the server on port 25 and doing an ehlo test.