$smtp_params["host"] = "localhost"; $smtp_params["port"] = "25"; $smtp_params["auth"] = true; $smtp_params["username"] = "someemail@yourdomain"; // you made in plesk $smtp_params["password"] = "you-secret-password"; //you set this in plesk for the email account
$mail =& Mail::factory("smtp", $smtp_params); $result = $mail->send($recipients, $headers, $body); if($result == 1) { echo 'Your message has been sent! IP Address: '.$ip.' Code: '. $result.'<br/><br/>';
Recently I've installed ejabberd server on Ubuntu box. Thanks to this nice document, the process was pretty straightforward. My experience was little bit different from the author's one, so I want to show here exact steps I did to make it work, maybe it will be helpful for you too.
The first step is to install the required package. You can use Synaptic Package Manager or just command line:
sudo apt-get install ejabberd
During the installation a new user, ejabberd, will be created in the system. This is the user the server will be running on. When installation is finished ejabberd server is started. To configure the server you need to stop it
sudo /etc/init.d/ejabberd stop
Next step is to configure administrator and hosts. Open /etc/ejabberd/ejabberd.cfg file for edit and make the following change
For admin you need to specify the user name and domain name that you want to use as a Jabber ID. By default it's localhost and it's functional but it's better to change it to something meaningful. The list of hostnames is tricky. In theory you can provide there just localhost but in practice it didn't work for me. After digging into some Erlang exceptions I got while registering admin account (see next step) I came to conclusion that in the list of hostnames there must be a short hostname of the box. You can get it by running hostname -s command (in my case it was "ubuntu"). In addition you can provide other hostnames you like, but the short one is mandatory.
When you are done with editing, start the server
sudo /etc/init.d/ejabberd start
Now it's time to register the admin user we configured on the previous step. Run the following command replacing password placeholders with the actual password and providing user name and domain name from ejabberd.cfg file
Another note: if you want groups enabled you will need to make one more change to /etc/ejabberd/ejabberd.cfg
remove the %% from in front of {mod_shared_roster,[]},
So change: %%{mod_shared_roster,[]},
to: {mod_shared_roster,[]},
and restart the service
Note when adding users to a roster or group remember to use the full context like: This email address is being protected from spambots. You need JavaScript enabled to view it.
Now the pesky cert that will keep yelling at you when you connect
this is what I did:
cd /
mkdir cert
openssl req -new -x509 -newkey rsa:1024 -days 3650 -keyout privkey.pem -out server.pem
note: Common Name is domain.
openssl rsa -in privkey.pem -out privkey.pem
cat privkey.pem >> server.pem
rm privkey.pem
mv server.pem /etc/ejabberd/server.pem
chown root:ejabberd /etc/ejabberd/server.pem
chmod 640 /etc/ejabberd/server.pem
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
This is the most common error you would get when you host your content on a UNC share. http://support.microsoft.com/?id=320268 describes the problem, resolution. However in this specific case content is not hosted on UNC share.
Cause
This issue would happen when you download a file from Internet or Network Location, etc. Windows now preserves the zone information forfile(s). This identifies where the file came from and displays appropriate warning messages, indicating you to be careful.
Note: Also when you copy the zip file from network location /Internet and extract the same, all the files contained in the zip file also will get this attribute set.
Resolution
You can resolve this issue by following any of the following methods.
Method#1 Go to the properties of precompiled dll’s, check to see if it has following security message (at the bottom of the window): "This file came from another computer and might be blocked to help protect this computer." If present, click "Unblock", "Apply" and "OK".
If you have multiple dlls in your application, you would need to perform this step to all dlls one by one.
Method#2 Run the below caspol command to resolve the issue Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////c:\mysitecontent\*" FullTrust -exclusive on
Note: Please substitute "c:\mysitecontent\*" with actual path where ASP.net pre compiled dlls are located.
Alternatively, you can use below methods to get around the issue.
To avoid the "This file came from another computer and might be blocked to help protect this computer." You can use one of the following methods depending on your scenario.
1) Move all the files to non NTFS partition i.e. FAT and move them back to NTFS partition. When you move the files to non NTFS partition, it will not maintain zone information.
b. Execute the following command from command line:
"streams -s -d directory"
3) If you have copied a zip file to your machine that has the above attribute, before you extract, just unblock the zip file( as mentioned in resolution section) and then proceed with extraction.
4) There is a Group Policy, that you can Enable to make sure zone information is not preserved.
a. Run gpedit.msc ( From Run Prompt or CMD prompt)
b. Navigate to Local Security Policy ==> User Configuration ==> Administrative Templates ==>Windows Components ==>Attachment Manager
c. Enable "Do not preserve zone information in file attachments" setting.
This will only make sure that zone information is not present for the files that you copy after the policy is enabled. For Existing files, you would still need to use one of the above methods. Also, please consult with your Administrator, Team before you enable this setting, as this might be needed for other applications and might break those, if you enable it without taking consent from Administrator(s)/your team.